mirror of https://github.com/golang/go.git
An import path is not the same as a package path. For example, the declaration: import "example.com/foo" may load a package whose PkgPath() is "vendor/example.com/foo". There was a comment hinting at this in load.go. This change introduces the concept of ImportPath as a distinct type from PackagePath, and documents clearly throughout the relevant APIs which one is expected. Notes: - Metadata.PkgPath is consistently set from the PackagePath, not sometimes (when a root) from PackagePath and sometimes (when indirectly loaded) from an arbitrary ImportPath that resolves to it. I expect this means some packages will now (correctly) appear to be called "vendor/example.com/foo" in the user interface where previously the vendor prefix was omitted. - Metadata.Deps is gone. - Metadata.Imports is a new map from ImportPath to ID. - Metadata.MissingDeps is now a set of ImportPath. - the package loading key is now based on a hash of unique imports. (Duplicates would cancel out.) - The ImporterFunc no longer needs the guesswork of resolveImportPath, since 'go list' already told us the correct answer. - Package.GetImport is renamed DirectDep(packagePath) to avoid the suggestion that it accepts an ImportPath. - Package.ResolveImportPath is the analogous method for import paths. Most clients seem to want this. Change-Id: I4999709120fff4663ba8669358fe149f1626bb8e Reviewed-on: https://go-review.googlesource.com/c/tools/+/443636 Run-TryBot: Alan Donovan <adonovan@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> |
||
|---|---|---|
| .. | ||
| builtin.go | ||
| completion.go | ||
| deep_completion.go | ||
| deep_completion_test.go | ||
| definition.go | ||
| format.go | ||
| fuzz.go | ||
| keywords.go | ||
| labels.go | ||
| literal.go | ||
| package.go | ||
| package_test.go | ||
| postfix_snippets.go | ||
| printf.go | ||
| printf_test.go | ||
| snippet.go | ||
| statements.go | ||
| util.go | ||
| util_test.go | ||