36 Commits
Author SHA1 Message Date
junv 2ad422375d Bump version to 1.0.30 2016-03-06 21:17:17 +08:00
junv e383017680 update readme 2016-03-06 20:58:55 +08:00
junv f987a3628c replase googlecode with github 2016-03-06 20:53:14 +08:00
junv a19aa82656 update source repo 2016-01-13 15:36:33 +08:00
Junv 310a36ced1 add github repo url 2016-01-12 00:15:31 +08:00
Joshua Bussdieker 25ea8ae158 Add gvm use -h. Fixes #128 2015-12-17 12:39:08 -08:00
Joshua Bussdieker 20fe6c5214 Merge pull request #167 from bronzdoc/enhancement/install_success_message
Add success message after go installation
2015-12-17 12:26:48 -08:00
Joshua Bussdieker 680e356630 Merge pull request #138 from uhoh-itsmaciek/respond-to-requests-for-help
Respond to help command by showing usage info
2015-12-17 12:26:26 -08:00
Joshua Bussdieker f7916c90b4 Merge pull request #163 from nikolas/patch-1
Add --default option to documentation
2015-12-17 12:24:18 -08:00
Joshua Bussdieker 2feeac7454 Merge pull request #168 from todd/install_15x_note
Add Go 1.5 Compilation Notes
2015-10-24 14:37:19 -07:00
Todd Bealmear 725bc293b2 📝 Add Go 1.5 Compilation Notes [ci skip] 2015-10-24 14:21:57 -07:00
bronzdoc 98c36fedb9 Add success message after go installation 2015-10-14 20:48:50 -06:00
Nik Nyby f62c61ec5c Add --default option to documentation 2015-10-08 13:32:30 -04:00
Joshua Bussdieker 8b7e848371 Merge pull request #157 from ilons/master
Should add source_line properly for bashrc
2015-09-11 08:58:58 -07:00
Ilon Sjögren 604e702e2a Should add source_line properly for bashrc 2015-09-10 13:52:01 +02:00
Joshua Bussdieker 595852af11 Merge pull request #139 from nmabhinandan/master
Pre appended newline to source_line
2015-09-09 08:37:57 -07:00
Joshua Bussdieker e34bbfc017 Merge pull request #154 from kei-yamazaki/goroot_bootstrap
Fix compilation problem of go1.5
2015-09-09 08:35:57 -07:00
Kei YAMAZAKI 707e5de0ba Fix compilation problem of go1.5 2015-08-20 09:58:20 +09:00
Gregory G. Tseng ff81688ece Merge pull request #140 from david-poirier/master
changed gvm install to go1.4
2015-07-10 10:56:08 -07:00
David Poirier 5366dd903d changed gvm install to go1.4 2015-06-12 11:20:22 +10:00
Abhinandan d32b62bf31 Pre appended newline to source_line
Playing it safe
2015-05-28 13:51:43 +05:30
Maciek Sakrejda e66076be0d Respond to help command by showing usage info 2015-05-21 21:17:41 -07:00
Joshua Bussdieker bba42f81f9 Merge pull request #132 from nikolas/fix-typos
Fix typos: specifiy -> specify
2015-04-16 16:00:57 -07:00
Joshua Bussdieker 7fd2678da2 Merge pull request #135 from tchoulihan/patch-1
Show the useful gvm listall command
2015-04-16 16:00:18 -07:00
Tyler Houlihan 9cf079ba24 Show the useful gvm listall command
It took me a while to find this, but the gvm listall command is probably its most useful feature, and its not even on the front page.
2015-04-14 23:04:53 -04:00
Nik Nyby 4231e20b6a Fix typos: specifiy -> specify 2015-04-08 23:13:13 -04:00
Gregory G. Tseng 670008ebb9 Merge pull request #116 from tianon/go1.4-cross
Fix "gvm cross" for Go 1.4
2015-02-03 21:12:42 -08:00
Tianon Gravi ece4351a6b Fix some whitespace inconsistencies in scripts/cross 2015-02-03 22:03:22 -07:00
Tianon Gravi d1db113a52 Fix "gvm cross" for Go 1.4
> go tool dist: opendir /home/user/.gvm/gos/go1.4/src/pkg/runtime: No such file or directory
> ERROR: Couldn't compile runtime library for darwin amd64
2015-02-03 22:03:22 -07:00
Gregory G. Tseng c6850e273a Merge pull request #122 from naoina/master
Change Go source repository to git
2015-02-03 18:00:22 -08:00
Naoya Inada ccbb978c9a Fix for installation of master 2015-02-04 10:44:32 +09:00
Naoya Inada e1ea0e745f Change Go source repository to git 2015-02-04 09:49:50 +09:00
Gregory G. Tseng 121663b898 Merge pull request #118 from runcom/curl_dependency_check
Add check for curl dependency
2015-02-03 10:51:55 -08:00
Antonio Murdaca f2a28de3cf Add check for curl dependency 2015-02-03 19:33:35 +01:00
Gregory G. Tseng b5144138b0 Merge pull request #119 from runcom/fix_download_older_go_version
Fix download for older go binary version
2015-02-03 10:31:36 -08:00
Antonio Murdaca 9bc84bc286 Fix download for older go binary version 2015-01-11 22:35:12 +01:00
18 changed files with 101 additions and 48 deletions
+23 -6
View File
@@ -1,11 +1,13 @@
# gvm
[![Build Status](https://travis-ci.org/moovweb/gvm.svg?branch=master)](https://travis-ci.org/moovweb/gvm)
# gvm-cn
by Josh Bussdieker (jbuss, jaja, jbussdieker)
GVM provides an interface to manage Go versions.
说明
========
该版本使用github的源代码,解决在中国国内不能使用gvm安装Go的问题
Features
========
* Install/Uninstall Go versions with `gvm install [tag]` where tag is "60.3", "go1", "weekly.2011-11-08", or "tip"
@@ -26,14 +28,14 @@ Installing
To install:
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
bash < <(curl -s -S -L https://raw.githubusercontent.com/wahyd4/gvm/master/binscripts/gvm-installer)
Or if you are using zsh just change `bash` with `zsh`
Installing Go
=============
gvm install go1
gvm use go1 [--default]
gvm install go1.4
gvm use go1.4 [--default]
Once this is done Go will be in the path and ready to use. $GOROOT and $GOPATH are set automatically.
Additional options can be specified when installing Go:
@@ -46,6 +48,17 @@ Additional options can be specified when installing Go:
-B, --binary Only install from binary.
--prefer-binary Attempt a binary install, falling back to source.
-h, --help Display this message.
### A Note on Compiling Go 1.5
Go 1.5+ removed the C compilers from the toolchain and [replaced][compiler_note] them with one written in Go. Obviously, this creates a bootstrapping problem if you don't already have a working Go install. In order to compile Go 1.5+, make sure Go 1.4 is installed first.
```
gvm install go1.4
gvm use go1.4
gvm install go1.5
```
[compiler_note]: https://docs.google.com/document/d/1OaatvGhEAq7VseQ9kkavxKNAfepWy2yhPUBs96FGV28/edit
List Go Versions
================
@@ -53,6 +66,10 @@ To list all installed Go versions (The current version is prefixed with "=>"):
gvm list
To list all Go versions available for download:
gvm listall
Uninstalling
============
To completely remove gvm and all installed Go versions and packages:
+1 -1
View File
@@ -1 +1 @@
1.0.22
1.0.30
+5 -4
View File
@@ -34,9 +34,7 @@ else
if [ -f "$GVM_ROOT/scripts/$command" ]; then
shift
"$GVM_ROOT/scripts/$command" "$@"
elif [[ -n $command ]]; then
display_fatal "Unrecognized command line argument: '$command'"
else
elif [[ -z $command || $command = help ]]; then
echo "Usage: gvm [command]
Description:
@@ -45,8 +43,9 @@ Description:
Commands:
version - print the gvm version number
get - gets the latest code (for debugging)
use - select a go version to use
use - select a go version to use (--default to set permanently)
diff - view changes to Go root
help - display this usage text
implode - completely remove gvm
install - install go versions
uninstall - uninstall go versions
@@ -58,5 +57,7 @@ Commands:
pkgset - manage go packages sets
pkgenv - edit the environment for a package set
"
else
display_fatal "Unrecognized command line argument: '$command'"
fi
fi
+3 -3
View File
@@ -11,9 +11,9 @@ display_error() {
update_profile() {
[ -f "$1" ] || return 1
grep "$source_line" "$1" > /dev/null 2>&1
grep -F "$source_line" "$1" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$source_line" >> "$1"
echo -e "\n$source_line" >> "$1"
fi
}
@@ -45,7 +45,7 @@ EOF
BRANCH=${1:-master}
GVM_DEST=${2:-$HOME}
GVM_NAME="gvm"
SRC_REPO=${SRC_REPO:-https://github.com/moovweb/gvm.git}
SRC_REPO=${SRC_REPO:-https://github.com/wahyd4/gvm.git}
[ "$GVM_DEST" = "$HOME" ] && GVM_NAME=".gvm"
+2 -2
View File
@@ -2,10 +2,10 @@
. "$GVM_ROOT/scripts/functions"
[[ $1 != "" ]] ||
display_fatal "Please specifiy the alias name"
display_fatal "Please specify the alias name"
[[ $2 != "" ]] ||
display_fatal "Please specifiy the go version name"
display_fatal "Please specify the go version name"
[[ ! -f "$GVM_ROOT/environments/$1" ]] ||
display_fatal "Alias already exists!"
+1 -1
View File
@@ -2,7 +2,7 @@
. "$GVM_ROOT/scripts/functions"
[[ $1 != "" ]] ||
display_fatal "Please specifiy the name"
display_fatal "Please specify the name"
[[ -f $GVM_ROOT/environments/$1 ]] ||
display_fatal "Alias doesn't exist!"
+1 -1
View File
@@ -58,7 +58,7 @@ _gvm()
install)
[ ! -d $GVM_ROOT/archive/go ] && return 1
[[ $COMP_CWORD > 2 ]] && return 1
local version="$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | $GREP_PATH -E "release|tip|go"`; do echo ${x} ; done )"
local version="$(cd $GVM_ROOT/archive/go && for x in `git tag | $GREP_PATH -E "release|tip|go"`; do echo ${x} ; done )"
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
return 0
;;
+12 -6
View File
@@ -28,10 +28,10 @@ if [ ! -f "$GOROOT/pkg/tool/cross" ]; then
display_message "Installing x86, x86-64, and ARM commands"
set -e
for arch in 8 6 5; do
for cmd in a c g l; do
go tool dist install -v cmd/$arch$cmd ||
display_fatal "Couldn't compile tool: $arch$cmd"
done
for cmd in a c g l; do
go tool dist install -v cmd/$arch$cmd ||
display_fatal "Couldn't compile tool: $arch$cmd"
done
done
touch "$GOROOT/pkg/tool/cross"
fi
@@ -44,11 +44,17 @@ export GOARCH=$1
if [ ! -d "$GOROOT/pkg/${GOOS}_${GOARCH}" ]; then
display_message "Installing $GOOS $GOARCH runtime library"
if [ "$GOOS" = "windows" ]; then
export CGO_ENABLED=0
export CGO_ENABLED=0
fi
cd "$GOROOT/src"
go tool dist install -v pkg/runtime ||
if [ -d pkg/runtime ]; then
runtime='pkg/runtime'
else
# Go 1.4 moved pkg/ up a level
runtime='runtime'
fi
go tool dist install -v "$runtime" ||
display_fatal "Couldn't compile runtime library for $GOOS $GOARCH"
go install -v -a std ||
display_fatal "Install runtime library for $GOOS $GOARCH"
+7 -2
View File
@@ -1,12 +1,17 @@
#!/usr/bin/env bash
function gvm_use() {
if [[ "$1" == "-h" ]]; then
display_message "Usage: gvm use VERSION [--default]"
return 1
fi
[[ "$1" != "" ]] ||
display_error "Please specifiy the version" || return 1
display_error "Please specify the version" || return 1
local VERSION=$1
fuzzy_match=$($LS_PATH "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1")
if [[ "$?" != "0" ]]; then
GO_CACHE_PATH=$GVM_ROOT/archive/go
version=$(hg tags -R "$GO_CACHE_PATH" | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION")
version=$(cd "$GO_CACHE_PATH" && git tag -l "$VERSION")
if [[ "x$version" == "x" ]]; then
display_error "Version not found locally. Try 'gvm install $1'" || return 1
else
+10
View File
@@ -9,3 +9,13 @@ GREP_PATH=$(unalias grep &> /dev/null; which grep) || display_error "$GREP_ERROR
SORT_PATH=$(unalias sort &> /dev/null; which sort) || display_error "$SORT_ERROR" || return 1
HEAD_PATH=$(unalias head &> /dev/null; which head) || display_error "$HEAD_ERROR" || return 1
GITHUB_REPO_URL=https://github.com/golang/go.git
GOOGLE_REPO_URL=https://go.googlesource.com/go
repo_url() {
if [[ "$GOOGLE" == "true" ]]; then
return GOOGLE_REPO_URL
else
return GITHUB_REPO_URL
fi
}
+11 -3
View File
@@ -3,10 +3,10 @@
error_message=""
# Check for hg
which hg &> /dev/null ||
# Check for git
which git &> /dev/null ||
error_message="${error_message}
Could not find mercurial
Could not find git
linux: apt-get install mercurial
mac: brew install mercurial
@@ -39,6 +39,14 @@ Could not find make
linux: apt-get install make
"
# Check for curl
which curl &> /dev/null ||
error_message="${error_message}
Could not find curl
linux: apt-get install curl
mac: brew install curl
"
if [ -n "$error_message" ]; then
display_warning "$error_message"
+14 -11
View File
@@ -21,7 +21,7 @@ read_command_line() {
show_usage
exit 1
fi
GO_SOURCE_URL=https://go.googlecode.com/hg/
GO_SOURCE_URL=https://github.com/golang/go.git
for i in "$@"; do
case $i in
-s=*|--source=*)
@@ -59,28 +59,29 @@ download_source() {
GO_CACHE_PATH=$GVM_ROOT/archive/go
[[ -d $GO_CACHE_PATH ]] && return
display_message "Downloading Go source..."
hg clone "$GO_SOURCE_URL" "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 ||
git clone "$GO_SOURCE_URL" "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 ||
display_fatal "Couldn't download Go source. Check the logs $GVM_ROOT/logs/go-download.log"
}
check_tag() {
version=$(hg tags -R "$GO_CACHE_PATH" | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH -w "$VERSION")
version=$(cd "$GO_CACHE_PATH" && git show-ref --heads --tags | awk -F/ '{ print $NF }' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH -w "$VERSION")
}
update_source() {
display_message "Updating Go source..."
hg pull -R "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 ||
display_fatal "Couldn't get latest Go version info. Check the logs $GVM_ROOT/logs/go-download.log"
(cd "$GO_CACHE_PATH" && git pull >> "$GVM_ROOT/logs/go-download.log" 2>&1 ||
display_fatal "Couldn't get latest Go version info. Check the logs $GVM_ROOT/logs/go-download.log")
}
copy_source() {
hg clone -u "$version" "$GO_CACHE_PATH" "$GO_INSTALL_ROOT" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 ||
git clone -b "$version" "$GO_CACHE_PATH" "$GO_INSTALL_ROOT" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 ||
display_fatal "Couldn't copy source to target folder. Check the logs $GVM_ROOT/logs/go-$GO_NAME-install.log"
}
compile_go() {
display_message " * Compiling..."
[ -z "$GOROOT_BOOTSTRAP" ] && export GOROOT_BOOTSTRAP=$GOROOT
unset GOARCH && unset GOOS && unset GOPATH && unset GOBIN && unset GOROOT &&
export GOBIN=$GO_INSTALL_ROOT/bin &&
export PATH=$GOBIN:$PATH &&
@@ -145,6 +146,8 @@ install_go() {
copy_source
compile_go
create_enviroment
display_message "$GO_NAME successfully installed!"
}
download_binary() {
@@ -181,8 +184,8 @@ download_binary() {
curl -s -f -L $GO_BINARY_URL > ${GO_BINARY_PATH}
if [[ $? -ne 0 ]]; then
display_error "Failed to download binary go from http://golang.org. Trying https://storage.googleapis.com"
GO_BINARY_URL="https://storage.googleapis.com/golang/${GO_BINARY_FILE}"
display_error "Failed to download binary go from http://golang.org. Trying https://go.googlecode.com"
GO_BINARY_URL="https://go.googlecode.com/files/${GO_BINARY_FILE}"
curl -s -f -L $GO_BINARY_URL > ${GO_BINARY_PATH}
@@ -256,12 +259,12 @@ install_goprotobuf() {
return 1
fi
else
$GVM_GOINSTALL code.google.com/p/goprotobuf/proto > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1
$GVM_GOINSTALL github.com/golang/protobuf > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1
if [[ $? -ne 0 ]]; then
display_warning "Failed to install goprotobuf. Check the logs at $GVM_ROOT/logs/$GO_NAME-pb-compiler.log"
return 1
fi
$GVM_GOINSTALL code.google.com/p/goprotobuf/protoc-gen-go > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1
$GVM_GOINSTALL github.com/golang/protobuf > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1
if [[ $? -ne 0 ]]; then
display_warning "Failed to install goprotobuf compiler. Check the logs at $GVM_ROOT/logs/$GO_NAME-pb-compiler.log"
return 1
@@ -285,7 +288,7 @@ install_from_source() {
which goinstall &> /dev/null ||
GVM_GOINSTALL="go get"
x="$(hg tags -R "$GO_CACHE_PATH")"; echo "${x#*b0819469a6df}" | $GREP_PATH "$version " &> /dev/null
x="$(cd "$GO_CACHE_PATH" && git tag)"; echo "${x#*b0819469a6df}" | $GREP_PATH "$version " &> /dev/null
if [[ "$?" == "1" ]]; then
if [[ "$INSTALL_BUILD_TOOLS" == "true" ]]; then
install_gb || display_warning "Failed to install gb"
+2 -1
View File
@@ -32,7 +32,8 @@ read_command_line "$@"
echo
display_message "gvm gos (available)"
echo
versions=$(curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $SORT_PATH)
go_repo_url=repo_url
versions=$(git ls-remote -t ${go_repo_url} | awk -F/ '{ print $NF }' | $SORT_PATH)
if [[ $? -ne 0 ]]; then
display_fatal "Failed to get version list from Google"
fi
+1 -1
View File
@@ -2,7 +2,7 @@
. "$GVM_ROOT/scripts/functions"
[[ $1 != "" ]] ||
display_fatal "Please specifiy the name"
display_fatal "Please specify the name"
target_top=$GVM_ROOT
target_set_name=$1
+1 -1
View File
@@ -5,7 +5,7 @@
display_fatal "No Go version selected"
[[ $1 != "" ]] ||
display_fatal "Please specifiy the name"
display_fatal "Please specify the name"
target_top=$GVM_ROOT
target_set_name=$1
+1 -1
View File
@@ -2,7 +2,7 @@
. "$GVM_ROOT/scripts/functions"
[[ "$1" == "" ]] &&
display_fatal "Please specifiy the version"
display_fatal "Please specify the version"
fuzzy_match=$($LS_PATH "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1") ||
display_fatal "Invalid version $1"
+1 -1
View File
@@ -4,5 +4,5 @@
cd "$GVM_ROOT/archive/go" &> /dev/null ||
display_fatal "Failed to find local Go source"
hg pull || display_fatal "Failed to update"
git pull || display_fatal "Failed to update"
+5 -3
View File
@@ -1,11 +1,13 @@
## Cleanup test objects
gvm uninstall tip > /dev/null 2>&1
gvm uninstall go1.4 > /dev/null 2>&1
gvm uninstall master > /dev/null 2>&1
gvm uninstall go1.1.1 > /dev/null 2>&1
gvm uninstall go1.2.2 > /dev/null 2>&1
#######################
gvm install tip #status=0
gvm list #status=0; match=/tip/
gvm install go1.4 #status=0
GOROOT_BOOTSTRAP=$GVM_ROOT/gos/go1.4 gvm install master #status=0
gvm list #status=0; match=/master/
gvm install go1.1.1 #status=0
gvm list #status=0; match=/go1.1.1/
gvm install go1.2.2 #status=0