【发布时间】:2021-03-14 14:09:08
【问题描述】:
我的 GOROOT 路径:-
C:\Go
我已将 GOPATH 设置为:-
C:\Users\kunal\go
但是当我在 VS Code 中导入模块(如 github.com/gorilla/mux)时。 VS Code 提示我这个错误:-
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))
从上面很明显,它显示了我没有设置的两个不同的 GOPATH。我该如何解决这个问题?
【问题讨论】:
-
GOPATH 时间已经结束(根本就没有 GOROOT 时间)。使用 Go 模块。
标签: go environment-variables gopath