skip to Main Content

I tried below things

  1. Restart of VSCode
  2. Uninstalled and installed Go plugin from google team for VSCode
  3. Ran gopls server in code repo using go get golang.org/x/tools/gopls@latest

2

Answers


  1. Chosen as BEST ANSWER

    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

     "go.toolsEnvVars": {        
        "CGO_LDFLAGS_ALLOW":".*"
     }
    

    After that, all the modules were loaded successfully and VSCode was able to provide intelliSense.


  2. Sometimes vscode do not detect the GOPATH and GOROOT, try to set them manualy in the user settings (JSON) like so :

      "go.gopath": "..path..",
      "go.goroot": "..path..",
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search