簡體   English   中英

嘗試從 github 安裝模塊時 Go 安裝命令顯示 404 錯誤

[英]Go install command show 404 error when trying to install module from github

我開發了一個 go 模塊並將其推送到 github,當我嘗試使用go install命令安裝它時

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.

PS:回購是公開的

完整的命令是

go install github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest

你可以這樣安裝它: go install github.com/hvuhsg/lokidbServer/cmd@latest

如果 repo 是你的,我建議將文件夾lokidb添加到 cmd 文件夾,並將主要的 package 放入其中。

以這個 repo 為例:

go install github.com/fraugster/parquet-go/cmd/csv2parquet@latest

另一種選擇是將文件添加到目錄的根目錄,就像它在此處所做的那樣(在這種情況下,go.mod 中的go.mod被定義為 ZBF215181B5140522137B3D4F6B7354/ github.com/vektra/mockery/v2

go install github.com/vektra/mockery/v2@latest

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM