英文:
trouble installing "gorilla/mux" in golang
问题
所以我通过在终端上输入以下代码来安装gorilla/mux,以便在我的API中使用它:
go get -u github.com/gorilla/mux
由于没有返回任何错误(也没有任何文本),我认为安装成功了。但是当我开始使用“mux.”something时,vscode显示名称“mux”未声明。有人有类似的经验或知道如何解决这个问题吗?提前感谢。
(使用go1.18.3)
英文:
So I installed gorilla/mux to use it for my API by typing this code on terminal
go get -u github.com/gorilla/mux
And since it didn't return any errors (nor any texts) I thought the install was successful. But When I started to use "mux. "something, vscode showed that the name "mux" is not declared. Does anyone had any similar experience or know how to solve the problem? Thanks in advance.
(Using go1.18.3)
答案1
得分: 1
你的项目中没有go.sum
文件。
运行go mod tidy
,问题就会解决。
英文:
Your project doesn't have go.sum
file.
Run go mod tidy
and you will be good to go.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论