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: doesn't seem to vet text output formatting errors in non-core packages #34059

Open
urisimchoni opened this issue Sep 4, 2019 · 2 comments

Comments

@urisimchoni
Copy link

commented Sep 4, 2019

This may be related to #33085, but #33085 and its discussion seem to be focused on circular dependencies.

What version of Go are you using (go version)?

$ go version
go version go1.12.7 linux/amd64

gopls version
golang.org/x/tools/gopls v0.1.2
    golang.org/x/tools/gopls@v0.1.3 h1:CB5ECiPysqZrwxcyRjN+exyZpY0gODTZvNiqQi3lpeo=

Does this issue reproduce with the latest release?

I don't know - I believe gopls is latest.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/uri/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/uri/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build534950663=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Using VS-Code, with language server (gopls) enabled, write a small program such as the following and save it:

package main

import (
	"fmt"
	"io"

	"github.com/pkg/errors"
)

func main() {
	err := errors.Wrapf(io.EOF, "foo %s", 5)
	fmt.Printf("Err is %s\n", err)
}

What did you expect to see?

A warning "Wrapf format %s has arg 5 of wrong type int"

What did you see instead?

  • No errors or warnings reported.
  • Doing a "go vet" generates this warning.
  • A similar error on fmt package is flagged.

Gopls trace:

(this trace is generated when deleting a space that had intentionally created a syntax error, thereby making the code syntax-error-free, but with this formatting error)

Trace
[Trace - 8:26:12 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///home/uri/tst/main.go","version":17},"contentChanges":[{"range":{"start":{"line":10,"character":16},"end":{"line":10,"character":17}},"rangeLength":1,"text":""}]}

[Trace - 8:26:12 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/uri/tst/main.go","diagnostics":[]}

[Trace - 8:26:12 AM] Sending request 'textDocument/codeAction - (100)'.
Params: {"textDocument":{"uri":"file:///home/uri/tst/main.go"},"range":{"start":{"line":10,"character":16},"end":{"line":10,"character":16}},"context":{"diagnostics":[]}}

[Trace - 8:26:12 AM] Received response 'textDocument/codeAction - (100)' in 1ms.
Params: [{"title":"Organize Imports","kind":"source.organizeImports","edit":{"changes":{"file:///home/uri/tst/main.go":[]}}}]

[Trace - 8:26:13 AM] Sending request 'textDocument/documentSymbol - (101)'.
Params: {"textDocument":{"uri":"file:///home/uri/tst/main.go"}}

[Trace - 8:26:13 AM] Received response 'textDocument/documentSymbol - (101)' in 0ms.
Params: [{"name":"main","detail":"()","kind":12,"range":{"start":{"line":9,"character":0},"end":{"line":12,"character":1}},"selectionRange":{"start":{"line":9,"character":5},"end":{"line":9,"character":9}}}]

[Trace - 8:26:13 AM] Sending request 'textDocument/documentLink - (102)'.
Params: {"textDocument":{"uri":"file:///home/uri/tst/main.go"}}

[Trace - 8:26:13 AM] Received response 'textDocument/documentLink - (102)' in 0ms.
Params: [{"range":{"start":{"line":3,"character":1},"end":{"line":3,"character":6}},"target":"https://godoc.org/fmt"},{"range":{"start":{"line":4,"character":1},"end":{"line":4,"character":5}},"target":"https://godoc.org/io"},{"range":{"start":{"line":6,"character":1},"end":{"line":6,"character":24}},"target":"https://godoc.org/github.com/pkg/errors"}]

@urisimchoni urisimchoni changed the title gpls doesn't seem to vet text output formatting errors in non-core packages gopls doesn't seem to vet text output formatting errors in non-core packages Sep 4, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Sep 4, 2019

Thank you for filing a gopls issue! Please take a look at the Troubleshooting section of the gopls Wiki page, and make sure that you have provided all of the relevant information here.

@gopherbot gopherbot added the gopls label Sep 4, 2019

@ALTree ALTree changed the title gopls doesn't seem to vet text output formatting errors in non-core packages x/tools/gopls: doesn't seem to vet text output formatting errors in non-core packages Sep 4, 2019

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

/cc @matloob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.