2 回答

TA貢獻1851條經驗 獲得超3個贊
一種通過執行以下更改來更新代碼的方法。
在您的項目中打開您的go.mod
文件,并使用項目的最后一個提交哈希寫入。hello
replace
current version
github.com/user/say_things
say_things
換句話說,在go.mod
文件中
替換github.com/user/say_things <current-version>
為github.com/user/say_things <last-commit-hash>
最后運行:
$ go mod tidy $ go mod vendor

TA貢獻1802條經驗 獲得超10個贊
go get命令下載所需模塊的新版本。例如:
% go get -u all
go: github.com/user/say_things upgrade => v0.0.0-<new hash>
– 將所有最后一個模塊的版本下載到$GOPATH/pkg升級go.mod文件。
?使用go-modules時,更好的方法是向存儲庫添加版本標簽(tag必須符合語義版本控制規范)
git commit -a - m "say_things - some changes"
git tag v1.0.1
git push
git push --tags
這將允許您手動更改版本go.mod
module github.com/user/hello
go 1.15
require github.com/user/say_things v1.0.1
% go mod download
go: finding github.com/user/say_things v1.0.1
, 并通過版本標簽獲取所需版本
% go get github.com/user/[email protected]
go: finding github.com/user/say_things v1.0.1
go: downloading github.com/user/say_things v1.0.1
go: extracting github.com/user/say_things v1.0.1
- 2 回答
- 0 關注
- 198 瀏覽
添加回答
舉報