Git Can';t访问Go图书馆
我有一个正在运行的go项目,我在其中添加了一些库。 直到这一步,一切都很顺利。然后我将代码推送到服务器。我再次尝试从存储库中获取新的克隆,但出现以下错误 转到文件找不到错误 当我试着去做时,我得到了 这种方法有什么错 当我检查存储库时,我可以看到git library存储库指向其他存储库提交。Git Can';t访问Go图书馆,git,go,Git,Go,我有一个正在运行的go项目,我在其中添加了一些库。 直到这一步,一切都很顺利。然后我将代码推送到服务器。我再次尝试从存储库中获取新的克隆,但出现以下错误 转到文件找不到错误 当我试着去做时,我得到了 这种方法有什么错 当我检查存储库时,我可以看到git library存储库指向其他存储库提交。 你可以做几件事 检查您的GO版本,如果不是最新版本,则更新您的GO版本1.7 更新GO后,删除回购并再次克隆 您可以尝试使用以下步骤为Golang目录创建新导出: 这类问题在这些链接中提到: 我认
你可以做几件事
1.7
我认为最新版本已经解决了这个问题。希望如此我尝试了这种方法,它奏效了,因为这是我唯一剩下的解决办法: 重新克隆项目并在其中导航; 创建了
install.sh
,它将设置GOPATH,删除库,然后重新下载
#!/bin/sh
#GET current working directory
CURRENT_DIR=`pwd`
echo "GOPATH is pointing to ${CURRENT_DIR}"
#Export GOPATH for current working directory
export GOPATH=${CURRENT_DIR}
#Change Directory permission to executable
chmod +x ${GOPATH}
#Delete github dependency so that they can be reinstalled
#Github Issue: https://github.com/golang/go/issues/18591
#Modify this script if you are adding any other packages
rm -rf ${GOPATH}/src/github.com
#dependencies.txt contain list of go get -u (repo path)
#dependencies in new line add any new dependency and execute install.sh again
sh dependencies.txt
文件依赖项.txt
go get -u -v github.com/gorilla/mux
go get -u -v github.com/gorilla/handlers
go get -u -v github.com/dgrijalva/jwt-go
最后运行脚本,启动我的应用程序
run.sh
#!/bin/sh
#GET current working directory
CURRENT_DIR=`pwd`
echo "GOPATH is pointing to ${CURRENT_DIR}"
#Export GOPATH for current working directory
export GOPATH=${CURRENT_DIR}
echo "Starting server at http://localhost:9096"
#Run server instance
go run ${GOPATH}/path/to/main/file/Main.go
对于以下目录结构,所有这些都适用:
项目根目录
-----垃圾箱
-----包装
-----src
-----src/github.com/
-----src/github.com/gorilla/mux
-----src/github.com/gorilla/handlers
-----src/yours/project/code
我今天遇到了同样的问题,我通过在本地依赖项中初始化.git
repo解决了这个问题。所以在github.com/jinchu/gorm中运行:
git init
git add .
git commit -m "first commit"
什么是yout$GOPATH?export GOPATH=/testapp当我尝试删除软件包manullay和do go get all正在工作,但不适用于新克隆的项目go版本输出是go版本go1.7.4 darwin/amd64您使用的是什么操作系统,windows?我使用的是linux/amd64。如果您的问题仍然存在,那么您需要在go Repository中创建问题我的操作系统是MacSierra我无法获得解决方案,请在这里帮助我。谢谢,这对我很有效,在MacBook上使用go 1.12。
#!/bin/sh
#GET current working directory
CURRENT_DIR=`pwd`
echo "GOPATH is pointing to ${CURRENT_DIR}"
#Export GOPATH for current working directory
export GOPATH=${CURRENT_DIR}
echo "Starting server at http://localhost:9096"
#Run server instance
go run ${GOPATH}/path/to/main/file/Main.go
git init
git add .
git commit -m "first commit"