-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
- Run
go versionto get version of Go from the VS Code integrated terminal.- go1.17 darwin/amd64
- Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/gopls v0.7.2
- Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.- 1.60.2
- Check your installed extensions to get the version of the VS Code Go extension
- v0.28.1
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.- gopkgs: /Users/{username}/go/bin/gopkgs: go1.17
- go-outline: /Users/{username}/go/bin/go-outline: go1.17
- gotests: /Users/{username}/go/bin/gotests: go1.17
- gomodifytags: /Users/{username}/go/bin/gomodifytags: go1.17
- impl: /Users/{username}/go/bin/impl: go1.17
- goplay: /Users/{username}/go/bin/goplay: go1.17
- dlv: /Users/{username}/go/bin/dlv: go1.17
- dlv-dap: /Users/{username}/go/bin/dlv-dap: go1.17
- golint: /Users/{username}/go/bin/golint: go1.17
- gopls: /Users/{username}/go/bin/gopls: go1.17
Share the Go related settings you have added/edited
Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.
{
"go.toolsManagement.autoUpdate": true,
"go.lintTool": "golint",
"go.vetOnSave": "workspace"
}Describe the bug
When "Go:vet On Save is enabled in settings; and a go file is edited and saved (containing an error that go vet ./... does pick up), then no error squiggles appear in the editor to show that there is a vet error.
Required behavior
When "Go:vet On Save is enabled in settings; and a go file is edited and saved (containing an error that go vet ./... does pick up), then error squiggles MUST appear in the editor to show that there is a vet error.
Steps to reproduce the behavior:
- given a go file
testvet.gowith the following code
package testvet
import (
"fmt"
"sync"
)
// TestThatVetRunsOnSave minimal code to show vet not running on save in VS code
func TestThatVetRunsOnSave() {
ch := make(chan string)
var wg sync.WaitGroup
wg.Add(1)
go printit(wg, ch)
ch <- "one"
ch <- "two"
close(ch)
wg.Wait()
fmt.Println("done.")
}
func printit(wg sync.WaitGroup, ch chan string) {
defer wg.Done()
for t := range ch {
fmt.Println(t)
}
}- When I edit any text in this file that changes something, for example a space or comment
- Then the editor should highlight the same lines of code containing vet errors, that the command line
go vet ./...picks up as having an error.
pkg/testvet/testvet.go:14:13: call of printit copies lock value: sync.WaitGroup contains sync.noCopy
pkg/testvet/testvet.go:24:17: printit passes lock by value: sync.WaitGroup contains sync.noCopy
- Manually running the command , Go:vet workspace does work and causes the editor to report the correct errors and squigglies. (see screenshot below)
Screenshots or recordings
To be clear, the screenshot below is the behaviour that we WANT to happen and be triggered on save, this is currently not happening and only happens when you manually run the command Go;vet workspace
In addition to this functionality not working, the user interface helptext in VSCode settings does not make sense. The setting helptext has this text, which refers to functionality that I believe is not longer valid.
I have tried all variations of this setting value; both package and workspace. Neither works.

