suddenly, vscode cannot get access struct in the same package,but different files.
the error showed undefined struct
Previously vscode was able to instantiate struct across files(vscode+go1.12.4)
the sample code like this:
file1 a.go
package main
import "fmt"
type su struct {
Sfd string
Sf int
}
func (sed *su) do() {
fmt.Println(sed.Sfd + string(sed.Sf))
}
file2 main.go
package main
import "fmt"
func main() {
d := su{}
fmt.Println(d)
}
these two files are in the same package
have some one met the same problem?
Actually, the language server sometimes crashes. Open the Command Palette and type „language server“. A command should be shown that says „restart language server“. Restarting VSCode might be sufficient.
In GoLand, you can change the Run kind from file to Package.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With