golangバッグ管理ツール

20691 ワード

Gopmパッケージマネージャ
http://gopm.io/
gopm取付
go get -u github.com/gpmgo/gopm
gopm使用例
データベースのインストールxormplus操作
gopm get github.com/xormplus/xorm
golang dep
https://github.com/golang/dep https://golang.github.io/dep/
golang depインストール
go get -u github.com/golang/dep/cmd/dep
その他の取り付け方式https://golang.github.io/dep/docs/installation.html
golang depはどうやって使いますか?
https://golang.github.io/dep/docs/new-project.html
Glideの紹介
glideはGoのバッグ管理ツールです。意味化バージョンをサポートし、Git、Svnなどをサポートし、Goツールチェーンをサポートし、ventdorディレクトリをサポートし、Godep、GB、GPM、Gomからの流し込みをサポートし、プライベートのReposとForksをサポートします。
http://glidedocs.readthedocs.io/zh/latest/ 中国語版
https://glide.sh/ 公式サイト
Glideのインストール
curl https://glide.sh/get | sh
 
go get github.com/Masterminds/glide
このインストールは実行ファイルglideを自動的に生成します。ファイルは普通go/bin/ディレクトリの下にあります。このディレクトリに書き込み可能な権限が必要です。もちろん、このコマンドもサポートしなければなりません。
私のgoディレクトリはユーザールートディレクトリの下にあります。macシステム/Users/fox/go/go go言語ディレクトリです。
Glideコマンドglide createはプロジェクトを初期化し、glide.yamlファイルを作成します。glide initはプロジェクトを初期化し、glide.yamlファイルを作成します。glide updateは解析ダウンロードパケット依存性glide upを更新して、解析ダウンロードパケット依存性を更新します。glide installは単一のパケットglide getをインストールして、すべての関連付けられた依存パケット--all-dependenciesをダウンロードしてすべてのバージョン制御を削除します。例えば、git -sがネストを削除したベンダー-vは、依存名glide nameを参照して、依存リストglide listを参照してください。glide helpは、バージョンを参照してください。glide --versionは、パケットのミラーリングを代替するglide mirror set [original] [replacement]は、パケットのミラーリングを除去するglide mirror set [original] [replacement] --vcs [type]は、パケットのイメージリストを取得する。
ダウンロード
https://www.golangtc.com/download/package
方法はgo get golang.org/x/netのインストールに失敗しました。
使ったことがありますか?それともエラーがありますか?
glide mirror set https://golang.org/x/mobile https://github.com/golang/mobile --vcs git
glide mirror set https://golang.org/x/crypto https://github.com/golang/crypto --vcs git
glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
glide mirror set https://golang.org/x/tools https://github.com/golang/tools --vcs git
glide mirror set https://golang.org/x/text https://github.com/golang/text --vcs git
glide mirror set https://golang.org/x/image https://github.com/golang/image --vcs git
glide mirror set https://golang.org/x/sys https://github.com/golang/sys --vcs git
その後、あなたのプロジェクトでglide mirror remove [original]ファイルを修正します。glide mirror listの次のレベルで増加します。
- package: golang.org/x/net
これらのカバンはどれが間違っていますか?誤報があったカバンを追加して、全部入れないでください。使用したカバンだけ入れます。
例えば
package: blog
import:
- package: golang.org/x/net
- package: golang.org/x/sys
- package: golang.org/x/mobile
- package: golang.org/x/crypto
- package: golang.org/x/text
- package: golang.org/x/tools
- package: golang.org/x/image
。。。。        
方法の2は包みをダウンロードします
mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git #    net 
git clone https://github.com/golang/crypto.git #    crypto 
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/mobile.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/image.git
...        ,     
方法三は代理を通じて
まず、代理店が必要です。もしないなら、他の2つの方法で端末に設置してください。(ここで設定すれば、端末を閉じるのは無効です。)
export http_proxy=http://127.0.1:9000
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
gitエージェントも設定します。
git config --global http.proxy http://127.0.0.1:1080 
#git config --global https.proxy https://127.0.0.1:1080
代理が必要でない場合は、それを閉じることができます。
GIT       
git config --global --unset http.proxy 
#git config --global --unset https.proxy
GITは設定された値を表示します。
git config http.proxy
Glide生成のglide.ymlファイル説明
このリンクを見てください。http://blog.csdn.net/chenqijing2/article/details/55050843
Glideチーム開発時
glide.yamlとglide.lockをバージョン制御する必要があります。
Glideを使用したケースはありません。
ゼロから使用します。ダウンロードします。
wget https://github.com/foxiswho/blog-go/archive/master.zip
展開
unzip master.zip
         blog-go-master
ディレクトリを移動
mv blog-go-master ~/blog-go
環境変数を追加して、このディレクトリをGOPATHに追加して、あなたのGOPATH配置場所を見つけて修正します。
export GOPATH=/Users/fox/go/gopath:/Users/fox/blog-go
目次に入る
cd /Users/fox/blog-go/src/blog
Glide初期化
実行
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/astaxie/beego
[INFO]	--> Adding sub-package cache to github.com/astaxie/beego
[INFO]	--> Adding sub-package context to github.com/astaxie/beego
[INFO]	--> Adding sub-package httplib to github.com/astaxie/beego
[INFO]	--> Adding sub-package logs to github.com/astaxie/beego
[INFO]	--> Adding sub-package orm to github.com/astaxie/beego
[INFO]	--> Found reference to github.com/go-sql-driver/mysql
[INFO]	--> Found reference to github.com/qiniu/api.v7/auth/qbox
[INFO]	--> Adding sub-package storage to github.com/qiniu/api.v7
[INFO]	--> Found reference to github.com/russross/blackfriday
[INFO]	--> Found reference to github.com/xormplus/xorm
[INFO]	--> Found test reference to github.com/smartystreets/goconvey/convey
[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]	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

[INFO]	Here are some suggestions...
[INFO]	The package github.com/astaxie/beego appears to have Semantic Version releases (http://semver.org). 
[INFO]	The latest release is v1.9.2. You are currently not using a release. Would you like
[INFO]	to use this release? Yes (Y) or No (N)
Y
[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/astaxie/beego to use the release v1.9.2 instead of no release
[INFO]	The package github.com/astaxie/beego appears to use semantic versions (http://semver.org).
[INFO]	Would you like to track the latest minor or patch releases (major.minor.patch)?
[INFO]	The choices are:
[INFO]	 - Tracking minor version releases would use '>= 1.9.2, < 2.0.0' ('^1.9.2')
[INFO]	 - Tracking patch version releases would use '>= 1.9.2, < 1.10.0' ('~1.9.2')
[INFO]	 - Skip using ranges
[INFO]	For more information on Glide versions 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/astaxie/beego to use the range ~1.9.2 instead of commit id v1.9.2
[INFO]	Updating github.com/go-sql-driver/mysql to use the release v1.3 instead of no release
[INFO]	Updating github.com/go-sql-driver/mysql to use the range ~1.3.0 instead of commit id v1.3
[INFO]	Updating github.com/qiniu/api.v7 to use the release v7.2.3 instead of no release
[INFO]	Updating github.com/qiniu/api.v7 to use the range ~7.2.3 instead of commit id v7.2.3
[INFO]	Updating github.com/russross/blackfriday to use the release v2.0.0 instead of no release
[INFO]	Updating github.com/russross/blackfriday to use the range ~2.0.0 instead of commit id v2.0.0
[INFO]	Updating github.com/smartystreets/goconvey to use the release 1.6.3 instead of no release
[INFO]	Updating github.com/smartystreets/goconvey to use the range ~1.6.3 instead of commit id 1.6.3
[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ファイルを生成します。
golangエラー解決
glide mirror set https://golang.org/x/mobile https://github.com/golang/mobile --vcs git
glide mirror set https://golang.org/x/crypto https://github.com/golang/crypto --vcs git
glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
glide mirror set https://golang.org/x/tools https://github.com/golang/tools --vcs git
glide mirror set https://golang.org/x/text https://github.com/golang/text --vcs git
glide mirror set https://golang.org/x/image https://github.com/golang/image --vcs git
glide mirror set https://golang.org/x/sys https://github.com/golang/sys --vcs git
プロジェクトにおいて、glide.yamlファイルが修正されました。import:の次のレベルに追加されました。
- package: golang.org/x/net
- package: golang.org/x/sys
- package: golang.org/x/mobile
- package: golang.org/x/crypto
- package: golang.org/x/text
- package: golang.org/x/crypto
- package: golang.org/x/tools
- package: golang.org/x/image
これらのバッグは本プロジェクトで使用されます。全部加入します。
インストール依存glide.yamlを実行すると、glide.lockファイルが生成され、インストールパッケージのバージョンがロックされる。
級が上がる
このステップは必須ではなく、例えばいくつかのパッケージをアップグレードして実行できます。
glide up
ケースは既にGlideのアイテムを使用しています。
glide install
次号に続く