You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a0eb2d2
Browse filesBrowse the repository at this point in the historyBrowse files
fix(packages): resolve the standard library's own vendored imports
crypto/tls imports golang.org/x/crypto/chacha20poly1305, which the Go
distribution vendors at GOROOT/src/vendor. The toolchain-free loader could not
find it: the stdlib branch is gated on an import path whose first segment has no
dot, and every other branch answers for the module under scan. So a scan of any
tree reaching crypto/tls synthesized three x/crypto packages and said so, where
the go/packages loader synthesized none.
The resolver now carries a second vendor root. That is not a special case so
much as the second half of a rule it already had: go mod vendor flattens the
whole graph into the MAIN module's vendor directory and a dependency's own is
never read, so one root answers for module mode entirely -- and std is the
exception because std never goes through modload. The go command resolves its
imports with the older walk that climbs from the importing package to the source
root, which is how a package in GOROOT/src reaches GOROOT/src/vendor and nothing
outside it does.
That bound is why resolution now takes the importing directory. Both call sites
already had it. The package path carries the vendor/ prefix go list reports, so
the two loaders agree on identity.
The stub memo needed the same: it keyed on the import path alone, and the same
path has two honest answers now -- resolvable from std, not from anywhere else
-- so the first asker's was handed to everybody.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
0 commit comments