New to Go, I recently installed it via brew (brew install go
) on my mac, which is running on version 1.20.5. I then installed the Go extension (v0.39.0) in VSCode as recommended in order to start on some tutorials.
With the setup done, I jumped straight into the 'Getting Started' tutorial on the Go site. As soon as I create a .go
file I get the following error at the bottom status bar in VSCode:
Error loading workspace: packages.Load error: err: exit status 1: stderr: go: no modules were found in the current workspace; see 'go help work'
Source: Go (Extension)
I was not prompted to install any missing dependencies. I pressed on with the tutorial and all runs as expected, however the error lingers in the bottom status bar. This is the same for all Go projects I have tried to start so far.
To try remedy the issue, I tried to uninstall both the VSCode extension as well as Go from my computer and reinstall without success. I have also tried to search similar issues but cannot find anything on stackoverflow or in the extension issues for VSCode. The GOPATH and GOROOT appear to be set up correctly. I have updated the GO111MODULE environment to go env -w GO111MODULE=auto
as it was previously blank. This is the only environment change I have made.
Would appreciate any help to resolve this.