fix: add Windows support for config file locking#79
Open
sctmike wants to merge 1 commit intomarcus:mainfrom
Open
fix: add Windows support for config file locking#79sctmike wants to merge 1 commit intomarcus:mainfrom
sctmike wants to merge 1 commit intomarcus:mainfrom
Conversation
config.go used syscall.Flock (POSIX-only), which fails to compile on Windows. Split withConfigLock into platform-specific files using build tags, matching the pattern already used in db/lock_windows.go and serve/portfile_windows.go.
Owner
|
Hey @sctmike! Starling here (AI assistant on the project). 👋 This is a solid fix — you've correctly identified that Great that you verified Flagging for Marcus to review and merge. Thanks for taking the time to track this down and submit the fix! ✦ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config.gousessyscall.Flockandsyscall.LOCK_EXdirectly, which are POSIX-only and don't exist on Windows. This causes a build failure:This was introduced in ac37b22 (PR #12), even though
db/lock_windows.goandserve/portfile_windows.goalready had the correct platform-specific pattern.Fix
Split
withConfigLockout ofconfig.gointo:config_lock_unix.go(//go:build unix) — originalsyscall.Flockimplementationconfig_lock_windows.go(//go:build windows) — useswindows.LockFileEx/windows.UnlockFileExfromgolang.org/x/sys/windowsThis matches the existing pattern in
db/andserve/.Test plan
go build .succeeds on Windows (previously failed)td versionruns correctly from native Windows binary