Setting up the GO Environment (VSCode on Window 10)

I am suing VSCode IDE on Widnows for Go Development(v1.17.6). It’s a weird issue I am having. My imports don’t work as they should.

My package has an import "". When I go run main.go it says

no required module provides package; to add it:
        go get

I already did go init mod and go mod tidy to no effect (except reating the mod file with the module and go version).

I cn run go get, and it downloads the packages and updates the mod file too. And I can run go run main.go now without any errors.

My question is, why does not automagically download the imports? Did I miss a Environment setting or vairable or didn’t setup something correctly (like GOPATH or GOROOT)? I do have GO111MODULE=on in the ENVIRONMENT VARIABLES.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.