I tried below things
go get golang.org/x/tools/gopls@latest
2
Finally, I was able to solve this problem. My project was required export CGO_LDFLAGS_ALLOW=".*" env var to be set.
export CGO_LDFLAGS_ALLOW=".*"
So, I added below section to the settings.json of the Go plugin for vscode
"go.toolsEnvVars": { "CGO_LDFLAGS_ALLOW":".*" }
After that, all the modules were loaded successfully and VSCode was able to provide intelliSense.
Sometimes vscode do not detect the GOPATH and GOROOT, try to set them manualy in the user settings (JSON) like so :
GOPATH
GOROOT
"go.gopath": "..path..", "go.goroot": "..path..",
Click here to cancel reply.
2
Answers
Finally, I was able to solve this problem. My project was required
export CGO_LDFLAGS_ALLOW=".*"
env var to be set.So, I added below section to the settings.json of the Go plugin for vscode
After that, all the modules were loaded successfully and VSCode was able to provide intelliSense.
Sometimes vscode do not detect the
GOPATH
andGOROOT
, try to set them manualy in the user settings (JSON) like so :