英文:
Go install command show 404 error when trying to install module from github
问题
我开发了一个 Go 模块并将其推送到 GitHub,当我尝试使用 go install
命令安装它时,显示以下信息:
go: 正在下载 github.com/hvuhsg/lokidbServer v0.0.0-20220825205442-250079f3d6e9
go: github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: 验证模块: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: 读取 https://sum.golang.org/lookup/github.com/hvuhsg/lokidb!server@v0.0.0-20220825205442-250079f3d6e9: 404 Not Found
服务器响应:
未找到: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: 无效的版本: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/023bef7fbf7701c1dd80019746ac35a6d71aa94fa9b3961e0dadef371238a56e: 退出状态 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
请确认输入的导入路径是否正确。
如果这是一个私有仓库,请参阅 https://golang.org/doc/faq#git_https 获取更多信息。
附注:该仓库是公开的。
完整的命令是:
go install github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest
英文:
I developed a go module and pushed it to github, when I am trying to install it with the go install
command its showing
go: downloading github.com/hvuhsg/lokidbServer v0.0.0-20220825205442-250079f3d6e9
go: github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: verifying module: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: reading https://sum.golang.org/lookup/github.com/hvuhsg/lokidb!server@v0.0.0-20220825205442-250079f3d6e9: 404 Not Found
server response:
not found: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/023bef7fbf7701c1dd80019746ac35a6d71aa94fa9b3961e0dadef371238a56e: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
P.S: the repo is public
The full command is
go install github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest
答案1
得分: 0
你可以这样安装它:
go install github.com/hvuhsg/lokidbServer/cmd@latest
如果这个仓库是你自己的,我建议在cmd文件夹中添加一个lokidb文件夹,并将主要的包放在其中。
以这个仓库为例:
go install github.com/fraugster/parquet-go/cmd/csv2parquet@latest
另一种选择是在目录的根目录下添加一个文件,就像这里做的一样(在这种情况下,go.mod文件中定义的包是github.com/vektra/mockery/v2
):
go install github.com/vektra/mockery/v2@latest
英文:
You can install it like this:
go install github.com/hvuhsg/lokidbServer/cmd@latest
If the repo is yours, I would recommend adding a folder lokidb
to the cmd folder, and put the main package inside of it.
Check this repo as an example:
go install github.com/fraugster/parquet-go/cmd/csv2parquet@latest
Another option is to add a file to the root of the directory, like its done here (in this case, the package inside go.mod
is defined as github.com/vektra/mockery/v2
):
go install github.com/vektra/mockery/v2@latest
答案2
得分: 0
我遇到了同样的问题,但是过了一段时间问题自动解决了。我有一种感觉,可能是缓存出了问题。
尝试运行以下命令:
go list -m -versions github.com/username/module
英文:
I ran into the same problem, but after some time the problem resolved automatically. I've the impression that the cache was giving problems.
try:
go list -m -versions github.com/username/module
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论