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: include Go version information in gopls version output #49783

Closed
findleyr opened this issue Nov 24, 2021 · 7 comments
Closed

x/tools/gopls: include Go version information in gopls version output #49783

findleyr opened this issue Nov 24, 2021 · 7 comments
Labels
FeatureRequest FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. release-blocker Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

As discussed in CL 366736, gopls version lacks information about the Go version used to build gopls (and possibly the Go version found by exec.LookPath). We should add it, to facilitate bug reporting.

CC @hyangah

@findleyr findleyr added NeedsFix The path to resolution is known, but the work has not been done. FeatureRequest labels Nov 24, 2021
@findleyr findleyr added this to the gopls/on-deck milestone Nov 24, 2021
@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 Nov 24, 2021
@hyangah
Copy link
Contributor

hyangah commented Nov 24, 2021

In case gopls version output format changes significantly, we need to adjust vscode-go's gopls version parsing code and release vscode-go first.

@findleyr
Copy link
Contributor Author

In case gopls version output format changes significantly, we need to adjust vscode-go's gopls version parsing code and release vscode-go first.

If this is being parsed, maybe we should just add a -json flag? WDYT?

@hyangah
Copy link
Contributor

hyangah commented Nov 24, 2021

I think vscode-go should stop parsing gopls version result but use go version -m as part of managing versions of all tools. :-)

And I guess you may want to include the go version to the verbose output (gopls -v version) only.

@findleyr
Copy link
Contributor Author

I think vscode-go should stop parsing gopls version result but use go version -m as part of managing versions of all tools. :-)

Oh yeah, that sounds correct.

And I guess you may want to include the go version to the verbose output (gopls -v version) only.

Yes, I think this should be -v only. We'll ask people to invoke gopls -v version in the issue template.

@findleyr findleyr self-assigned this Dec 2, 2021
@hyangah
Copy link
Contributor

hyangah commented Dec 15, 2021

As discussed in #50085, the plan for utilizing go version -m cannot work unless the editor always chooses the latest go version the user ever used. It seems like -json based on runtime/debug.ReadBuildInfo is the best option for now (assuming it's unlikely runtime/debug.ReadBuildInfo format changes significantly in the future).

@findleyr findleyr modified the milestones: gopls/on-deck, gopls/v0.7.5 Dec 16, 2021
@findleyr findleyr modified the milestones: gopls/v0.7.5, gopls/v0.8.0 Jan 4, 2022
@gopherbot
Copy link

Change https://golang.org/cl/382274 mentions this issue: internal/lsp/debug: add go version to gopls version output

@findleyr findleyr assigned hyangah and unassigned findleyr Feb 2, 2022
gopherbot pushed a commit to golang/tools that referenced this issue Feb 7, 2022
Add -json flag to output in JSON format.

Include the Go version info
  - go1.18: runtime/debug.BuildInfo.GoVersion
  - pre go1.18: runtime.Version

Restructure ServiceVersion so we embed info from
runtime/debug.BuildInfo. Instead of directly using
runtime/debug.BuildInfo, we use our own BuildInfo type.
That allows:
  for go1.17 or older versions, we can add GoVersion.
  for go1.18, we can drop MarshalText that prevents
  JSON encoding other languages and human can understand
  (golang/go#51026)

For golang/go#49783

Change-Id: Ia5ab50ce1f5e6c3a912654834785ecea7f5034e2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382274
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@hyangah
Copy link
Contributor

hyangah commented Feb 7, 2022

Closing (ended up implementing -json flag in cl/382274 too)

@hyangah hyangah closed this as completed Feb 7, 2022
@rsc rsc unassigned hyangah Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. release-blocker 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