欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Glide--------Golang依賴包解決工具之錯誤實踐-創(chuàng)新互聯(lián)

1. 背景

成都創(chuàng)新互聯(lián)公司是一家業(yè)務范圍包括IDC托管業(yè)務,雅安服務器托管、主機租用、主機托管,四川、重慶、廣東電信服務器租用,成都電信服務器托管,成都網(wǎng)通服務器托管,成都服務器租用,業(yè)務范圍遍及中國大陸、港澳臺以及歐美等多個國家及地區(qū)的互聯(lián)網(wǎng)數(shù)據(jù)服務公司。

   不論是開發(fā)Java還是你正在學習的Golang,都會遇到依賴管理問題。Java有牛逼轟轟的Maven和Gradle。 Golang亦有godep、govendor、glide、gvt、gopack等等,本文主要給大家介紹gilde。 glide是Golang的包管理工具,是為了解決Golang依賴問題的。 為什么需要glide? 原因很簡單,Go 語言原生包管理的缺陷。羅列一下golang的 get 子命令管理依賴有很多大缺陷:

  * 能拉取源碼的平臺很有限,絕大多數(shù)依賴的是 github.com

  * 不能區(qū)分版本,以至于令開發(fā)者以最后一項包名作為版本劃分

  * 依賴 列表/關系 無法持久化到本地,需要找出所有依賴包然后一個個 go get

  * 只能依賴本地全局倉庫(GOPATH/GOROOT),無法將庫放置于局部倉庫($PROJECT_HOME/vendor)

2.  Error問題

   項目中使用到了golang.org/x/crypto/ssh包,而由于國內網(wǎng)絡原因,無法直接下載,需要提前從github.com/golang/crypto下載然后放到指定位置

   * 項目中glide依賴初始化

[lisea@lisea test]$ glide init
[INFO]	Generating a YAML configuration file and guessing the dependencies
[INFO]	Attempting to import from other package managers (use --skip-import to skip)
[INFO]	Scanning code to look for dependencies
[INFO]	--> Found reference to github.com/pkg/sftp
[INFO]	--> Found reference to golang.org/x/crypto/ssh
[INFO]	Writing configuration file (glide.yaml)
[INFO]	Would you like Glide to help you find ways to improve your glide.yaml configuration?
[INFO]	If you want to revisit this step you can use the config-wizard command at any time.
[INFO]	Yes (Y) or No (N)?
Y
[INFO]	Loading mirrors from mirrors.yaml file
[INFO]	Looking for dependencies to make suggestions on
[INFO]	--> Scanning for dependencies not using version ranges
[INFO]	--> Scanning for dependencies using commit ids
[INFO]	Gathering information on each dependency
[INFO]	--> This may take a moment. Especially on a codebase with many dependencies
[INFO]	--> Gathering release information for dependencies
[INFO]	--> Looking for dependency imports where versions are commit ids
Y
[INFO]	Here are some suggestions...
[INFO]	The package github.com/pkg/sftp appears to have Semantic Version releases (http://semver.org). 
[INFO]	The latest release is 1.2.0. You are currently not using a release. Would you like
[INFO]	to use this release? Yes (Y) or No (N)
[INFO]	Would you like to remember the previous decision and apply it to future
[INFO]	dependencies? Yes (Y) or No (N)
Y
[INFO]	Updating github.com/pkg/sftp to use the release 1.2.0 instead of no release
[INFO]	The package github.com/pkg/sftp appears to use semantic versions (http://semver.org).
[INFO]	Would you like to track the latest minor or patch releases (major.minor.patch)?
[INFO]	Tracking minor version releases would use '>= 1.2.0, < 2.0.0' ('^1.2.0'). Tracking patch version
[INFO]	releases would use '>= 1.2.0, < 1.3.0' ('~1.2.0'). For more information on Glide versions
[INFO]	and ranges see https://glide.sh/docs/versions
[INFO]	Minor (M), Patch (P), or Skip Ranges (S)?
P
[INFO]	Would you like to remember the previous decision and apply it to future
[INFO]	dependencies? Yes (Y) or No (N)
Y
[INFO]	Updating github.com/pkg/sftp to use the range ~1.2.0 instead of commit id 1.2.0
[INFO]	Configuration changes have been made. Would you like to write these
[INFO]	changes to your configuration file? Yes (Y) or No (N)
Y
[INFO]	Writing updates to configuration file (glide.yaml)
[INFO]	You can now edit the glide.yaml file.:
[INFO]	--> For more information on versions and ranges see https://glide.sh/docs/versions/
[INFO]	--> For details on additional metadata see https://glide.sh/docs/glide.yaml/

   * 初始化后生成的依賴如下:(glide.yaml)

[lisea@lisea test]$ cat glide.yaml 
package: test
import:
- package: github.com/pkg/sftp
  version: ~1.2.0
- package: golang.org/x/crypto/ssh

   * glide安裝依賴[ERROR報錯]

[lisea@lisea test]$ glide install
[INFO]	Loading mirrors from mirrors.yaml file
[INFO]	Lock file (glide.lock) does not exist. Performing update.
[INFO]	Loading mirrors from mirrors.yaml file
[INFO]	Downloading dependencies. Please wait...
[INFO]	--> Fetching golang.org/x/crypto/ssh
[INFO]	--> Fetching updates for github.com/pkg/sftp
[WARN]	Unable to checkout golang.org/x/crypto/ssh
[ERROR]	Update failed for golang.org/x/crypto/ssh: Cannot detect VCS
[ERROR]	Failed to do initial checkout of config: Cannot detect VCS

3.  ERROR解決

   經(jīng)通過度娘查詢一圈發(fā)現(xiàn),十個結果九個一樣內容(在此鄙視抓內容的站點和純copy的博主三秒種),最后在glide開源點github上的issue上找到解決方式

  * 修改glide生成的glide.yaml文件

package: test
import:
- package: github.com/pkg/sftp
  version: ~1.2.0
- package: golang.org/x/crypto/ssh

修改為:

package: test
import:
- package: github.com/pkg/sftp
  version: ~1.2.0
- package: golang.org/x/crypto
  subpackages:
  - ssh

  * 重新更新下載依賴

[lisea@lisea test]$ glide up
[INFO]	Loading mirrors from mirrors.yaml file
[INFO]	Downloading dependencies. Please wait...
[INFO]	--> Fetching updates for golang.org/x/crypto
[INFO]	--> Fetching updates for github.com/pkg/sftp
[INFO]	--> Detected semantic version. Setting version for github.com/pkg/sftp to 1.2.0
[INFO]	Resolving imports
[INFO]	--> Fetching updates for github.com/kr/fs
[INFO]	--> Fetching updates for github.com/pkg/errors
[INFO]	Downloading dependencies. Please wait...
[INFO]	Setting references for remaining imports
[INFO]	Exporting resolved dependencies...
[INFO]	--> Exporting github.com/pkg/errors
[INFO]	--> Exporting github.com/pkg/sftp
[INFO]	--> Exporting golang.org/x/crypto
[INFO]	--> Exporting github.com/kr/fs
[INFO]	Replacing existing vendor dependencies
[INFO]	Project relies on 4 dependencies.

successfully 成功解決

4. 總結

以需求驅動技術,技術本身沒有優(yōu)略之分,只有業(yè)務之分。

創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。

本文名稱:Glide--------Golang依賴包解決工具之錯誤實踐-創(chuàng)新互聯(lián)
轉載源于:http://aaarwkj.com/article0/dpiioo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站企業(yè)建站、軟件開發(fā)、商城網(wǎng)站、用戶體驗、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
青青草国产精品一区二区| 欧美大吊视频在线观看| 国产精品亚洲在线视频| 久久精品国产亚洲七七| 国产亚洲一区二区自拍视频| 亚洲av天堂天天天堂色| 尤物视频在线观看一下| 午夜体内射精免费视频| 一区二区蜜桃在线观看| 久久久久久亚洲av黄床| 日日夜夜久久一二三区 | 国产熟女碰碰人人a久久| 欧美日韩精品一区二区视频永久免 | 欧美日韩精品视频网站| 一区二区精品福利视频| 国产欧美日韩一级二级三级| 午夜精品久久99蜜桃| 日韩欧美亚洲综合另类| 色婷婷综合激情一区二区| 国产传媒剧情剧资源网站| 日韩美少妇大胆一区二区| 哪里可以看黄色片日韩| 一区二区三区四区四虎| 久久精品国产亚洲av蜜点| 麻豆成人三级电影在线| 麻豆剧传媒国产精选av| 亚洲天堂男人的天堂狠狠操 | 国产有码视频一区二区三区| 久久免费欧美日韩亚洲| 免费在线观看一区二区三区视频| 1区2区3区精品视频| 国产精品一区二区夜夜夜| 婷婷久久香蕉毛片毛片| 亚洲欧美天堂一区二区| 日韩在线视频精品一区| 极品人妻视频中文字幕| 日本在线高清不卡免费播放| 成年人午夜在线观看网址| 丰满少妇一级淫片在线播放| 伊在人亚洲香蕉精品区| 日韩欧美一区二区三区不卡在线|