gox
通過github.com/golang,一鍵安裝golang.org/x的包
對於大陸的gopher來說,go get 安裝 golang.org/x的包經常失敗
所以在這裡寫了一個bash指令碼一鍵安裝golang.org/x的包
- windows使用者 git-bash 來執行gox.sh這個指令碼
- *unix使用者 先
chmod +x gox.sh
添加可以執行許可權.在使用./gox.sh
執行一鍵安裝
#!/usr/bin/env bash#為了相容windows下的bashcd $GOPATH;#建立 $GOPATH/src/golang.org/x 目錄mkdir -p src/golang.org/x;cd src/golang.org/x;echo "已經安裝的golang.org/x package";ls;echo "下面一行 for in 中包的名字您可以自己來定義"for name in "glog" "image" "perf" "snappy" "term" "sync" "winstrap" "cwg" "leveldb" "text" "net" "build" "protobuf" "dep" "sys" "crypto" "gddo" "tools" "scratch" "proposal" "mock" "oauth2" "freetype" "debug" "mobile" "gofrontend" "lint" "appengine" "geo" "review" "arch" "vgo" "exp" "time";do if [ -d "$name" ] then cd $name; echo $name "包已經存在,使用git pull來更新源碼"; git pull; else git_url="https://github.com/golang/${name}.git"; echo "開始clone golang.org/x 在github.com上的鏡像代碼:${git_url}"; git clone --depth 1 "$git_url"; cd $name; fi #go install;done