vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

Show warning, when overwriting variable

Open guettli opened this issue 10 months ago • 6 comments

Is your feature request related to a problem? Please describe.

I wrote that code, and I did not understand why path was empty, although findDev() returns a non-empty path:

func getDeviceFromPath(path string) (*evdev.InputDevice, error) {
	if path == "" {
		path, err := findDev()   // "path" of outer block gets overwritten
		if err != nil {
			return nil, err
		}
		fmt.Printf("Using device %q\n", path)
	}
	sourceDev, err := evdev.Open(path)

Describe the solution you'd like

I would like to see a warning in vscode, when I overwrite a variable from the outer scope.

Describe alternatives you've considered

I could use external linters, but I think that should be available "out of the box".

guettli avatar Jan 31 '25 08:01 guettli