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

Glide--------Golang依賴(lài)包解決工具之錯(cuò)誤實(shí)踐

1. 背景

專(zhuān)注于為中小企業(yè)提供成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)資陽(yáng)免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上1000家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

     不論是開(kāi)發(fā)Java還是你正在學(xué)習(xí)的Golang,都會(huì)遇到依賴(lài)管理問(wèn)題。Java有牛逼轟轟的Maven和Gradle。 Golang亦有g(shù)odep、govendor、glide、gvt、gopack等等,本文主要給大家介紹gilde。 glide是Golang的包管理工具,是為了解決Golang依賴(lài)問(wèn)題的。 為什么需要glide? 原因很簡(jiǎn)單,Go 語(yǔ)言原生包管理的缺陷。羅列一下golang的 get 子命令管理依賴(lài)有很多大缺陷:

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

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

    * 依賴(lài) 列表/關(guān)系 無(wú)法持久化到本地,需要找出所有依賴(lài)包然后一個(gè)個(gè) go get

    * 只能依賴(lài)本地全局倉(cāng)庫(kù)(GOPATH/GOROOT),無(wú)法將庫(kù)放置于局部倉(cāng)庫(kù)($PROJECT_HOME/vendor)

2.  Error問(wèn)題

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

     * 項(xiàng)目中g(shù)lide依賴(lài)初始化

[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/

     * 初始化后生成的依賴(lài)如下:(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安裝依賴(lài)[ERROR報(bào)錯(cuò)]

[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)通過(guò)度娘查詢(xún)一圈發(fā)現(xiàn),十個(gè)結(jié)果九個(gè)一樣內(nèi)容(在此鄙視抓內(nèi)容的站點(diǎn)和純copy的博主三秒種),最后在glide開(kāi)源點(diǎn)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

    * 重新更新下載依賴(lài)

[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. 總結(jié)

以需求驅(qū)動(dòng)技術(shù),技術(shù)本身沒(méi)有優(yōu)略之分,只有業(yè)務(wù)之分。

分享題目:Glide--------Golang依賴(lài)包解決工具之錯(cuò)誤實(shí)踐
轉(zhuǎn)載注明:http://aaarwkj.com/article22/peiscc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、企業(yè)建站、域名注冊(cè)、網(wǎng)站制作、網(wǎng)站營(yíng)銷(xiāo)商城網(wǎng)站

廣告

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

成都網(wǎng)站建設(shè)
日本一区二区三区在线观看视频| 久久99热婷婷精品一区| 欧美黑人在线一区二区| 亚洲巨人精品福利导航| 夫妻过性生活视频播放| 亚洲欧美日韩老汉影院| 国产乱码精品一区二区蜜臀| 国产精品青青草原在线| 亚洲婷婷综合精品五月天| 亚洲av永久精品一区二区三区| 理论三级麻豆国产在线| 日韩性视频激情在线一区| 欧美日韩视频在线第一页| 亚洲奇米精品一区二区| 国产激情久久久久久久久久久| 成人性生活三级黄色片| 国产欧美又粗又猛又爽老| 久久综激情丁香开心婷婷| 中文字幕人妻中文av不卡专区| 日韩精品熟女一区二区三区| 国产传媒在线观看网站| 久久色综合色悠悠色综合色| 青青草视频在线针对华人| 国产老熟女高潮视频| 亚洲一区二区精品自拍| 欧美日韩另类国产综合| 欧美日韩一级一区二区| 免费在线成人av观看| 青青草原网址在线观看| 欧美亚洲另类日韩综合网| 亚洲精品尤物福利在线一区| 亚洲精品啪啪一区二区| 少妇视频资源一区二区三区| 欧美日韩中文国产天堂| 亚洲av天堂免费在线观看| 国产三级精品三级专区| 日本一区二区高清网址| 免费黄片视频大全在线播放 | 日韩免费色视频一区| 中文字幕中出亚洲精品| 久久这里精品中文字幕|