reset workspace env

Issue

I accidentally clicked Go: reset workspace env in Visual Studio Code, and the local Go environment won’t work

My Go version is 1.18

Failed to run ‘/usr/local/go/bin/go env’ (cwd: /Users/kejie/go/ms): Error: Command failed: /usr/local/go/bin/go env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
the path provided to GOWORK must be an absolute path

the path provided to GOWORK must be an absolute path

➜  go env 

the path provided to GOWORK must be an absolute path

Solution

  • What does echo $GOWORK say? Reset it if not empty from the commandline e.g. unset GOWORK, and relaunch vscode with the new env var.
  • If user profile or workspace settings.json has go.toolsEnvVars field, try to delete the field and restart vscode.

Answered By – Hana

Answer Checked By – Dawn Plyler (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.