Skip to content

feat(windows): add Windows compatibility guards and build target - #398

Merged
javi11 merged 3 commits into
mainfrom
feat/windows-compatibility
Mar 7, 2026
Merged

feat(windows): add Windows compatibility guards and build target#398
javi11 merged 3 commits into
mainfrom
feat/windows-compatibility

Conversation

@javi11

@javi11 javi11 commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Reject ImportStrategySYMLINK at config validation on Windows with a clear error pointing users to STRM instead
  • Guard all os.Symlink call sites (symlink_creator, library_sync, metadata/service, health_handlers) with runtime.GOOS == "windows" checks so the binary never panics or silently corrupts state on Windows
  • UpdateIDSymlink skips gracefully on Windows (internal optimization, not critical for correctness)
  • Add build-cli-windows Makefile target using MinGW-w64 cross-compilation with inline prerequisite comments (WinFsp, MinGW-w64)
  • Add Windows path examples to config.sample.yaml (Z: drive letter, C:\altmount directory mount, import_dir example)
  • Skip symlink-dependent tests on Windows via runtime.GOOS guard

Files changed

File Change
internal/config/manager.go Reject SYMLINK strategy on Windows at validation time
internal/importer/postprocessor/symlink_creator.go Guard createSingleSymlink on Windows
internal/health/library_sync.go Guard updateSymlinkForMountChange on Windows
internal/metadata/service.go Skip UpdateIDSymlink gracefully on Windows
internal/api/health_handlers.go Return 400 from handleRegenerateSymlinks on Windows
Makefile Add build-cli-windows cross-compilation target
config.sample.yaml Add Windows path examples and SYMLINK warning
*_test.go (×2) Skip symlink tests on Windows

Test plan

  • go build ./... succeeds (verified locally)
  • All tests in modified packages pass (go test ./internal/config/... ./internal/importer/... ./internal/metadata/... ./internal/health/...)
  • Cross-compile with make build-cli-windows on Linux (requires gcc-mingw-w64-x86-64)
  • Verify config validation returns clear error when import_strategy: SYMLINK is set on Windows
  • Verify STRM import strategy works end-to-end on Windows (already cross-platform)

🤖 Generated with Claude Code

javi11 and others added 3 commits March 7, 2026 13:47
- Reject ImportStrategySYMLINK at config validation on Windows with
  a clear error pointing users to STRM instead
- Guard all os.Symlink call sites (symlink_creator, library_sync,
  metadata/service, health_handlers) with runtime.GOOS == "windows"
  checks so the binary never panics or silently corrupts state
- UpdateIDSymlink skips gracefully on Windows (internal optimization,
  not critical for correctness)
- Add build-cli-windows Makefile target using MinGW-w64 cross-compilation
  with inline prerequisite comments (WinFsp, MinGW-w64)
- Add Windows path examples to config.sample.yaml (drive letter Z:,
  directory mount C:\altmount, import_dir example)
- Skip symlink-dependent tests on Windows via runtime.GOOS guard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uncomment the windows/amd64 matrix entry in the release workflow so
that cross-compiled Windows .exe artifacts are produced on every tag
via Zig (x86_64-windows-gnu). Also fix the ldflags that injected
version info into non-existent main.* vars; they now correctly target
github.com/javi11/altmount/internal/version.* so released binaries
report the real version string instead of dev/unknown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uard health tests

Add filepath.ToSlash() around filepath.Dir() calls in CreateDirectoriesForFiles
and DetermineFileLocation so the slash-based CutPrefix checks work correctly on
Windows after filepath.Clean() converts separators to backslashes.

Add runtime.GOOS == "windows" t.Skip guards to health tests that rely on
symlink-based workflows or hardcoded Unix paths (/mnt/test, /media/library/...,
/nzbs/...), following the pattern already used in postprocessor tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javi11
javi11 merged commit 48a1d5b into main Mar 7, 2026
2 checks passed
@javi11
javi11 deleted the feat/windows-compatibility branch March 7, 2026 19:34
yoshitaka420 pushed a commit to yoshitaka420/altmount that referenced this pull request Jun 1, 2026
…silabs#398)

* feat(windows): add Windows compatibility guards and build target

- Reject ImportStrategySYMLINK at config validation on Windows with
  a clear error pointing users to STRM instead
- Guard all os.Symlink call sites (symlink_creator, library_sync,
  metadata/service, health_handlers) with runtime.GOOS == "windows"
  checks so the binary never panics or silently corrupts state
- UpdateIDSymlink skips gracefully on Windows (internal optimization,
  not critical for correctness)
- Add build-cli-windows Makefile target using MinGW-w64 cross-compilation
  with inline prerequisite comments (WinFsp, MinGW-w64)
- Add Windows path examples to config.sample.yaml (drive letter Z:,
  directory mount C:\altmount, import_dir example)
- Skip symlink-dependent tests on Windows via runtime.GOOS guard
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.

1 participant