簡體   English   中英

如何設置私有倉庫的 go 模塊路徑

[英]How to set go module path of private repository

我想將我的 go 模塊路徑設置為example.com/myrepo而不是github.com/myusername/myrepo以便我能夠在另一個存儲庫中導入。

例如,如果我的 go.mod 看起來像這樣

module example.com/myrepo

go 1.13

我將如何讓go get example.com/myrepo工作?

我在go get example.com/myrepo上得到以下信息

unrecognized import path "example.com/myrepo" (parse https://example.com/myrepo?go-get=1: no go-import meta tags ())

鑒於我是example.com的所有者,我該怎么做?

它被稱為虛榮導入路徑

In addition to the common hosting sites (GitHub, Bitbucket, etc) and custom VCS URLs (.git, .hg, etc) known to the go command, this mechanism can be used to point a custom URL to any of the services.

你一定在找這個https://sagikazarmark.hu/blog/vanity-import-paths-in-go/

暫無
暫無

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

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