Problem in GOPATH variable

My GOROOT path :-

C:\Go

I have set GOPATH to :-

C:\Users\kunal\go

but when I import modules (like “github.com/gorilla/mux”) in VS Code. VS Code prompts me this error :-

could not import github.com/gorilla/mux (cannot find package "github.com/gorilla/mux" in any of 
C:\Go\src\github.com\gorilla\mux (from $GOROOT)
C\src\github.com\gorilla\mux (from $GOPATH)
\Users\kunal\go\src\github.com\gorilla\mux (from $GOPATH))

From above It is clear that it shows me two different GOPATH which I haven’t set. How do I fix this?

GOPATH is obsolete.
Use go modules (with go version 1.16).

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