Skip to content

fix: core/go passes on Windows; Windows CI job (fixes #29) - #30

Merged
Snider merged 3 commits into
mainfrom
fix/windows-tests
Nov 24, 2026
Merged

Snider merged 3 commits into
mainfrom
fix/windows-tests

Conversation

@Snider

@Snider Snider commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #29. The suite now passes natively on Windows 11 (go test ./..., 0 failures, from 31 behind a panic) and a windows-latest CI job keeps it that way.

Behaviour fixes

  • PathBase/PathDir: on the native separator they now use filepath (as CleanPath already does), which on Windows splits on / as well as \. Before, PathBase("/format.go") was /format.go there.
  • PathIsAbs: a leading backslash is rooted on Windows.
  • GeneratePack: asset names are relative slash paths on every OS (it embedded the full C:\... path).
  • Unsetenv(""): a no-op everywhere (Windows rejected it).

Test-only: slash-form comparisons, platform file modes, Windows std handles, TMP/USERPROFILE, closed streams before cleanup, an Extract target no OS can create, .exe fixtures where an execute bit was assumed.

🤖 Generated with Claude Code
Co-Authored-By: Virgil virgil@lethean.io

Summary by CodeRabbit

  • New Features

    • Added Windows to the continuous integration checks, including code analysis and tests.
  • Bug Fixes

    • Improved path handling and asset generation across operating systems.
    • Empty environment-variable names now return success without changing the environment.
    • Updated file and path behaviour to better match Windows conventions.

Snider and others added 2 commits November 24, 2026 13:14
…Windows takes / too; Windows-aware tests

Fixes #29. On Windows PathBase split only on a backslash, so
PathBase("/format.go") was "/format.go": that broke hasListedExt's dot
check and the LSP SPOR owner lookup (and its alloc gate). Like CleanPath,
both now hand the native case to filepath, which splits on both. The
isExecutable/Find tests now name the fixture .exe on Windows (no execute
bit there), and Find's test stops on a failed Result instead of panicking.

Co-Authored-By: Virgil <virgil@lethean.io>
First native Windows run found 31 failures behind a panic. Real fixes:
- PathBase/PathDir hand the native case to filepath (both separators on
  Windows); PathBase("/format.go") was "/format.go" there, breaking the
  extension check and the LSP SPOR owner lookup.
- PathIsAbs: a leading backslash is rooted on Windows (Path writes "/tmp"
  back as "\\tmp" there, which PathIsAbs then called relative).
- GeneratePack: asset names relativised and slash-converted; trimming a
  "/" prefix never matched a Windows path, so the full C:\\... path was
  embedded as the name.
- Unsetenv("") is a no-op on every OS (Windows rejected it).
Test-only: slash-form comparisons, platform file modes, Windows handles,
TMP/USERPROFILE, closed streams, an Extract target no OS can create (the
old one was creatable on C:), .exe fixtures where an exec bit was assumed.

Co-Authored-By: Virgil <virgil@lethean.io>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

This change adds a Windows CI job, updates path and filesystem handling and tests for Windows, and makes Unsetenv return success for an empty key.

Changes: Windows portability

Layer / File(s) Summary
Path and asset handling
path.go, embed.go, path_example_test.go, path_test.go, fs_internal_test.go
PathBase and PathDir use native path operations for the native separator. PathIsAbs recognises a leading backslash on Windows. GeneratePack derives relative asset names and uses slash-separated paths. Related examples and tests compare slash-normalised results.
Filesystem and OS test portability
embed_test.go, fs_test.go, os_example_test.go, os_test.go
Filesystem tests close streams and account for Windows permission bits. OS tests account for Windows handles and environment variables. The extraction failure test uses a cross-platform target setup.
Windows CI and executable tests
.github/workflows/ci.yml, app_example_test.go, app_internal_test.go, app_test.go
The CI workflow adds a Windows job for go vet and uncached tests. App examples and tests use Windows executable names where required. The app lookup test stops if Find fails.

Empty environment key handling

Layer / File(s) Summary
Empty-key handling
os.go
Unsetenv returns success without calling os.Unsetenv when the key is empty.

Severity of issue fixed: Medium

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
embed.go 50.00% 1 Missing and 1 partial ⚠️
fs.go 88.88% 1 Missing and 1 partial ⚠️
path.go 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

… too

The protected-path check compared against "/" and $HOME. Windows usually
has no HOME, and its roots are drive roots, so neither the user's home nor
C:\\ was protected there. isProtectedPath asks the OS for the home as well,
treats any root (its own parent) as protected, and ignores case on Windows.
Also: Chdir/Getwd tests resolve 8.3 short names (Windows CI's RUNNER~1).

Co-Authored-By: Virgil <virgil@lethean.io>
@Snider
Snider merged commit 0612718 into main Nov 24, 2026
2 checks passed
@Snider
Snider deleted the fix/windows-tests branch November 24, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core/go test suite fails on Windows (first native run)

1 participant