Change information
Commit message:
gopls/internal/analysis/unusedfunc: use non-heuristic std check
This CL changes the logic for detecting whether a package is
part of std, from packagepath.IsStdPackage (a purely formal
check) to stdlib.HasPackage, which checks the manifest.
Also, rename IsStdPackage to MaybeStdPackage to indicate its
heuristic nature, flag this in its documentation, and audit
all other uses. And fix two tests that had the same latent
bug.
Fixes golang/go#80555
Change-Id: Ifc2bbc5ebaeddf45f3d59edef9c1a01fbe16ad9d
Files:
- M go/analysis/passes/modernize/modernize.go
- M go/packages/packages_test.go
- A gopls/internal/analysis/unusedfunc/testdata/issue80555.txtar
- M gopls/internal/analysis/unusedfunc/unusedfunc.go
- M gopls/internal/analysis/unusedfunc/unusedfunc_test.go
- M gopls/internal/mcp/context.go
- M gopls/internal/test/marker/testdata/codeaction/extract_variable-toplevel.txt
- M gopls/internal/test/marker/testdata/token/shadowing.txt
- M internal/analysis/analyzerutil/version.go
- M internal/packagepath/packagepath.go
- M internal/packagepath/packagepath_test.go
- M internal/refactor/imports.go
Change size: M
Delta: 12 files changed, 42 insertions(+), 17 deletions(-)
Branch: refs/heads/master