mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 00:51:28 +02:00
Two problems with the lookup that finds this module's source for a suite in
another module.
A caller that vendors its dependencies puts the go command in automatic vendor
mode, where `go list -m -f {{.Dir}}` succeeds and reports an EMPTY directory —
vendor/ holds packages, not module source, so there is nothing for it to report.
The harness took that for a missing module and told the caller to run `go mod
download` for a dependency that was already there. Ask in readonly mode instead,
which resolves against the module graph and answers for both a cached module and
a local replacement, without writing to go.mod.
The lookup also ran on context.Background(), so a StartCombined, StartClient or
StartProxy whose context was cancelled could not stop it. repoRoot and moduleDir
now take the caller's context.
The vendor-mode case has a regression test, which needs no network: a temporary
main module with a local replacement, vendored. It fails without the flag with
the misleading "run `go mod download`" error. moduleDir takes the module path as
a parameter so that test can name its own.
The assertions move to testify, matching the repository's guidelines.