Repository navigation
Fix TestImportPath outside a folder named "specsync" - #151
Merged
Merged
Conversation
TestImportPath asserted the resolved package directory's basename ends in the literal string "specsync" — true for the primary clone, false for any git worktree named after its branch (this repo's own convention, e.g. specsync-<change>). Compare pkg.Dir against the test binary's own working directory instead: go test always sets it to the package's source directory, so this checks the real invariant (resolving the canonical import path lands back at wherever the package's files are) regardless of what the checkout is named on disk. Closes #150
Deploying specsync with
|
| Latest commit: |
8ea234b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://93f5b99a.specsync.pages.dev |
| Branch Preview URL: | https://fix-import-path-test-worktre.specsync.pages.dev |
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
Fixes #150.
TestImportPathasserted the resolved package directory's basename ends in the literal string"specsync"— true for the primary clone, false for any git worktree named after its branch (this repo's own convention:specsync-<change>). It's been failing in every worktree despite nothing being wrong with the package's location.Fix
Compare
build.Import's resolvedpkg.Diragainst the test binary's ownos.Getwd()instead of a literal folder-name check.go testalways sets the process's working directory to the package's source directory, so this checks the real invariant doc.go documents (resolving the canonical import path lands back at wherever the package's files actually are), regardless of what the checkout is named on disk. It still fails the way it's meant to if the package is ever relocated underpkg/.Testing
go build,go vet,go test ./...— zero failures now (previously 1, this test).release-plan/changelog -fail-on-unlinked-commits/audit-tasks/validateall pass.🤖 Generated with Claude Code