I have installed the Go extension (version 0.11.4) in Visual Studio Code on MacOS:
However, I find that the linter does not 'pick up' functions defined in the same package, but in different files. For example, if I create in the same directory a file foo.go
with
package foobar
import "fmt"
func main() {
fmt.Println(SayHello())
}
and a file bar.go
with
package foobar
func SayHello() string {
return "Hello, world!"
}
then in foo.go
I get a linter error that SayHello
is an undeclared name
:
I've read about a similar issue here (https://github.com/golang/lint/issues/57), but since that issue is five years old I figured it might be fixed by now? Or does golint
simply not work across multiple files?