Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: mod tidiness is a precondition for diagnostics #56395

Open
adonovan opened this issue Oct 24, 2022 · 1 comment
Open

x/tools/gopls: mod tidiness is a precondition for diagnostics #56395

adonovan opened this issue Oct 24, 2022 · 1 comment
Labels
gopls/metadata Issues related to metadata loading in gopls gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

If you build gopls at today's head and check out a new github.com/kubernetes/kubernetes repo, then run the 'check' subcommand, it fails because of the go.mod tidiness check:

kubernetes$ gopls check ./cmd/kubectl/kubectl.go 
2022/10/24 11:19:00 Error:2022/10/24 11:19:00 tidy: diagnosing file:///Users/adonovan/w/kubernetes/go.mod: err: exit status 1: stderr: go: bitbucket.org/bertimus9/systemstat@v0.0.0-20180207000608-0eeff89b0690: module lookup disabled by GOPROXY=off
go: downloading github.com/onsi/ginkgo v1.14.0
...many more...
go: downloading golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717
go: k8s.io/code-generator@v0.0.0 requires
	github.com/go-openapi/jsonreference@v0.19.5: module lookup disabled by GOPROXY=off

2022/10/24 11:19:00 Error:2022/10/24 11:19:00 tidy: diagnosing file:///Users/adonovan/w/kubernetes/go.mod: err: exit status 1: stderr: go: bitbucket.org/bertimus9/systemstat@v0.0.0-20180207000608-0eeff89b0690: module lookup disabled by GOPROXY=off
go: downloading github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
...
go: k8s.io/code-generator@v0.0.0 requires
	github.com/go-openapi/jsonreference@v0.19.5: module lookup disabled by GOPROXY=off

This remains true even after a successful go build ./cmd/kubectl/ to download modules. Running go mod tidy fixes the problem.

gopls should not make mod tidiness a precondition for analysis.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Oct 24, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 24, 2022
@adonovan adonovan modified the milestones: Unreleased, gopls/v0.10.1 Oct 24, 2022
@findleyr findleyr modified the milestones: gopls/v0.10.1, gopls/v0.10.2 Nov 1, 2022
@findleyr findleyr modified the milestones: gopls/v0.10.2, gopls/v0.11.0 Nov 10, 2022
@findleyr findleyr modified the milestones: gopls/v0.12.0, gopls/v0.13.0 Mar 27, 2023
@findleyr findleyr modified the milestones: gopls/v0.14.0, gopls/v0.15.0 Oct 9, 2023
@adonovan adonovan added the gopls/metadata Issues related to metadata loading in gopls label Dec 11, 2023
@findleyr findleyr modified the milestones: gopls/v0.15.0, gopls/v0.16.0 Jan 17, 2024
@findleyr findleyr modified the milestones: gopls/v0.16.0, gopls/v0.17.0 Mar 13, 2024
@gopherbot
Copy link

Change https://go.dev/cl/577655 mentions this issue: gopls: reduce noisy error messages

gopherbot pushed a commit to golang/tools that referenced this issue Apr 10, 2024
- Fix a bug in the logic to suppress a context cancellation error
  computing the shared import graph.
- Remove ErrIsDefinition. It was introduced for testing in CL 196560,
  and is no longer needed.
- Update golang.SignatureHelp to return (nil, nil) in the case where
  SignatureHelp is simply not available.
- Suppress the mod tidy diagnostic error when GOPROXY=off. It is too
  noisy, and golang/go#56395 tracks the fix for the root cause.
- Suppress noisy errors about semantic tokens. Researching the history
  behind this error, it seems it was only added to force the
  invalidation of semantic tokens client-side. The same can be achieved
  by returning a non-nil, empty result.
- Enforce that marker tests encounter no error logs, with an -errors_ok
  flag to allow them in select cases.
- Update the -min_go version of some marker tests that use a go.mod file
  with a too-new go version. This was an error log.

For golang/go#66746

Change-Id: I21fe274e320cf5fa7d6b85d7402330fb647dbd29
Reviewed-on: https://go-review.googlesource.com/c/tools/+/577655
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/metadata Issues related to metadata loading in gopls gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants