Error in downloading module

Whenever I download a module (eg :- go get from Windows PowerShell. Installed module found in $GOPATH/pkg/mod/ instead of GOPATH/src/ folder.

It is not an error.

Go Modules Reference

Module cache

The module cache is the directory where the go command stores downloaded module files. The module cache is distinct from the build cache, which contains compiled packages and other build artifacts.

The default location of the module cache is $GOPATH/pkg/mod. To use a different location, set the GOMODCACHE environment variable.

Whenever I use “go get < module name >”. I don’t found module files inside $GOPATH/src directory

But when I import the module inside VS code editor. It show me error that modules can’t be found inside GOROOT or GOPATH

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