[tools] gopls/internal/analysis/unusedfunc: use non-heuristic std check

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jul 24, 2026, 3:12:56 PM (2 days ago) Jul 24
to Alan Donovan, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Alex Putman, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

Gopher Robot submitted the change

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
Reviewed-by: Alex Putman <apu...@golang.org>
Auto-Submit: Alan Donovan <adon...@google.com>
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
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Ifc2bbc5ebaeddf45f3d59edef9c1a01fbe16ad9d
Gerrit-Change-Number: 805440
Gerrit-PatchSet: 5
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alex Putman <apu...@golang.org>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages