Navigation Menu

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: Diagnostic's CodeDescription field with empty href #42314

Closed
martskins opened this issue Oct 31, 2020 · 4 comments
Closed

x/tools/gopls: Diagnostic's CodeDescription field with empty href #42314

martskins opened this issue Oct 31, 2020 · 4 comments
Labels
FrozenDueToAge 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

@martskins
Copy link

martskins commented Oct 31, 2020

go version:
    go version go1.15.2 darwin/amd64

go version -m (which gopls):
    /path/to/go/bin//gopls: go1.15.2
        path    golang.org/x/tools/gopls
        mod     golang.org/x/tools/gopls        v0.0.0-20201031021630-582c62ec74d0      h1:rkV8jMWGmZrVZYXGAWnw2J2dFwvwVqU6bYbd1bOJKNo=
        dep     github.com/BurntSushi/toml      v0.3.1  h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
        dep     github.com/google/go-cmp        v0.5.2  h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
        dep     github.com/sergi/go-diff        v1.1.0  h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
        dep     golang.org/x/mod        v0.3.0  h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
        dep     golang.org/x/sync       v0.0.0-20201020160332-67f06af15bc9      h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
        dep     golang.org/x/tools      v0.0.0-20201031021630-582c62ec74d0      h1:obBdJPIfkOi5/rVh102giHaq0G8BZGE4eGB+NU6SgBo=
        dep     golang.org/x/xerrors    v0.0.0-20200804184101-5ec99f83aff1      h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
        dep     honnef.co/go/tools      v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
        dep     mvdan.cc/gofumpt        v0.0.0-20201027171050-85d5401eb0f6      h1:QQ9mYdTscaVSaHC8A1wtLkECzvpD/YO2E2GyPvU1D/Y=
        dep     mvdan.cc/xurls/v2       v2.2.0  h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=

What did you do?

Open a file that had diagnostics to be reported. For example:

package main

func main() {
	var a = 42
}

What did you expect to see?

The diagnostics with either no codeDescription or a codeDescription with an href field and non-empty value.

What did you see instead?

Diagnostics with {"codeDescription": {"href": ""}}.

To add a little more context: I'm not sure if that's being marshaled that way intentionally, but I get the impression that it wasn't what was intended, given that there's an omitempty tag on the field (https://github.com/golang/tools/blob/8dabb740183dd603f671da47324972b578eaf158/internal/lsp/protocol/tsprotocol.go#L1140), but that field being a (non-pointer) struct will never be omitted. As it is being sent right now it breaks at least LanguageClientNeovim, as it fails to deserialize that into an URL, given that the value is an empty string.

@leitzler
Copy link
Contributor

@gopherbot please add labels Tools, gopls

@gopherbot gopherbot added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Oct 31, 2020
@leitzler
Copy link
Contributor

cc @pjweinb

@martskins martskins changed the title Diagnostic's CodeDescription field with in x/tools/gopls: Diagnostic's CodeDescription field with empty href Nov 1, 2020
@gopherbot gopherbot added this to the Unreleased milestone Nov 1, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.3 Nov 2, 2020
@pjweinb
Copy link

pjweinb commented Nov 2, 2020

probably the right thing to do is to make Diagnostic.CodeDescription into a pointer. Let me look more closely.

@pjweinb pjweinb self-assigned this Nov 2, 2020
@gopherbot
Copy link

Change https://golang.org/cl/267106 mentions this issue: internal/lsp: make Diagnostics.CodeDescription a pointer

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

5 participants