Skip to content

Commit

Permalink
gopls/internal/lsp/cache: expand ImportPath!=PackagePath comment
Browse files Browse the repository at this point in the history
Change-Id: I2ea748a6a434bada2a310581538ac5d8dcefa01e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/454562
Auto-Submit: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Alan Donovan <[email protected]>
  • Loading branch information
adonovan authored and gopherbot committed Dec 2, 2022
1 parent 52c7b88 commit 2ad6325
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gopls/internal/lsp/cache/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,30 @@ func buildMetadata(ctx context.Context, pkg *packages.Package, cfg *packages.Con
// (Beware that, for historical reasons, go list uses
// the JSON field "ImportPath" for the package's
// path--effectively the linker symbol prefix.)
//
// The example above is slightly special to go list
// because it's in the std module. Otherwise,
// vendored modules are simply modules whose directory
// is vendor/ instead of GOMODCACHE, and the
// import path equals the package path.
//
// But in GOPATH (non-module) mode, it's possible for
// package vendoring to cause a non-identity ImportMap,
// as in this example:
//
// $ cd $HOME/src
// $ find . -type f
// ./b/b.go
// ./vendor/example.com/a/a.go
// $ cat ./b/b.go
// package b
// import _ "example.com/a"
// $ cat ./vendor/example.com/a/a.go
// package a
// $ GOPATH=$HOME GO111MODULE=off go list -json ./b | grep -A2 ImportMap
// "ImportMap": {
// "example.com/a": "vendor/example.com/a"
// },

// Don't remember any imports with significant errors.
//
Expand Down

0 comments on commit 2ad6325

Please sign in to comment.