Skip to content

fix: resolve test fixture paths via build.Import instead of $GOPATH/src#50

Open
jonbaldie wants to merge 2 commits into
avito-tech:masterfrom
jonbaldie:fix/test-gopath-paths
Open

fix: resolve test fixture paths via build.Import instead of $GOPATH/src#50
jonbaldie wants to merge 2 commits into
avito-tech:masterfrom
jonbaldie:fix/test-gopath-paths

Conversation

@jonbaldie
Copy link
Copy Markdown

The importing tests built expected file paths as os.Getenv("GOPATH") + "/src/...", which fails in module mode where packages are not stored under $GOPATH/src; they now use build.Import to find the real package directory on the current machine, and wildcard package resolution tests (which depend on GOPATH SrcDirs walking) are skipped in module mode with a clear explanation.

jonbaldie and others added 2 commits May 14, 2026 11:42
Tests built expected file paths as os.Getenv("GOPATH")+"/src/..." which
fails in module mode where packages live outside \$GOPATH/src; they now
use build.Import to find the actual package directory, and the wildcard
package resolution tests (which rely on GOPATH SrcDirs walking) are
skipped in module mode with a clear message.

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

Two functions called fixtureDir(t) at the outer scope even though the
resolved path was only used inside wildcard subtests; if package
resolution failed it skipped the whole test including file/directory
cases that never needed it. Also replaced the FilesOfArgs probe in
skipIfNoWildcard with a SrcDirs walk to avoid the spurious
warning printed to stderr on every module-mode run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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