亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

golang中的版本控制第三方包

golang中的版本控制第三方包

Go
至尊寶的傳說 2023-04-24 16:43:19
我在 golang 中使用第三方包,我想將它們添加到我的 git 存儲庫中,當我鍵入命令時,git add .出現以下錯誤warning: adding embedded git repository: github.com/beorn7/perkshint: You've added another git repository inside your current repository.hint: Clones of the outer repository will not contain the contents ofhint: the embedded repository and will not know how to obtain it.hint: If you meant to add a submodule, use:hint: hint:   git submodule add <url> github.com/beorn7/perkshint: hint: If you added this path by mistake, you can remove it from thehint: index with:hint: hint:   git rm --cached github.com/beorn7/perkshint: 如何確保我正確地控制包的版本以及我是否以正確的方式控制第三方包的版本?這是我的項目結構Project/|src/  |   github.com/      |      packages/我的 GOPATH 也指向項目目錄
查看完整描述

1 回答

?
慕運維8079593

TA貢獻1876條經驗 獲得超5個贊

據我了解,您不使用任何包管理器,而是將包導入 $GOPATH。我建議您使用包管理器,例如dep構建vendor包含所有依賴項的目錄。當您運行時,dep ensure它將遍歷您的代碼并自動提取所有依賴項。

編輯:自 go1.11 以來,作為 @jubobs,您可以使用go mod. 基本前提同上dep。


查看完整回答
反對 回復 2023-04-24
  • 1 回答
  • 0 關注
  • 191 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號