-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
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"}]