我正在尝试安装Gin,但在Ubuntu终端遇到了以下问题:
/go/src$ go get github.com/gin-gonic/gin
package github.com/gin-gonic/gin: no Go files in /home/user/go/src/github.com/gin-gonic/gin当我使用-u时,错误是另一种错误:
/go/src$ go get -u github.com/gin-gonic/gin
package github.com/gin-gonic/gin: directory "/home/user/go/src/github.com/gin-gonic/gin" is not using a known version control system我尝试了一个硬安装:
sudo apt-get install -y golang-github-gin-gonic-gin-dev但是有很多不便之处,比如在保存时lib/pq消失了-意味着mod.go不允许安装,以及在Gin项目->中运行main.go时面临以下问题:
Lec13$ go run main.go
routes/routes.go:4:2: package Lec13/controllers is not in GOROOT (/usr/local/go/src/Lec13/controllers)也许有人知道解决这个问题的方法?
提前谢谢。
发布于 2020-11-23 01:22:28
如果你确信go已经安装在你的系统中,你可以试着把golang添加到你的$path变量中。
export PATH=$PATH:$HOME/go/bin然后你可以再试一次。
https://stackoverflow.com/questions/64954766
复制相似问题