forked from moovweb/gvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
151 lines (115 loc) · 5.55 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# gvm
by Josh Bussdieker (jbuss, jaja, jbussdieker)
GVM provides an interface to manage Go versions.
Features
========
* Install/Uninstall Go versions with `gvm install [tag]` where tag is "60.3", "go1", "weekly.2011-11-08", or "tip"
* List added/removed files in GOROOT with `gvm diff`
* Manage GOPATHs with `gvm pkgset [create/use/delete] [name]`. Use `--local` as `name` to manage repository under local path (`/path/to/repo/.gvm_local`).
* List latest release tags with `gvm listall`. Use `--all` to list weekly as well.
* Cache a clean copy of the latest Go source for multiple version installs.
* Link project directories into GOPATH
Background
==========
When we started developing in Go mismatched dependencies and API changes plauged our build process and made it extremely difficult to merge with other peoples changes.
After nuking my entire GOROOT several times and rebuilding I decided to come up with a tool to oversee the process. It eventually evolved into what gvm is today.
Installing
==========
To install:
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/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]
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:
Usage: gvm install [version] [options]
-s, --source=SOURCE Install Go from specified source.
-n, --name=NAME Override the default name for this version.
-pb, --with-protobuf Install Go protocol buffers.
-b, --with-build-tools Install package build tools.
-B, --binary Only install from binary.
-h, --help Display this message.
List Go Versions
================
To list all installed Go versions (The current version is prefixed with "=>"):
gvm list
Uninstalling
============
To completely remove gvm and all installed Go versions and packages:
gvm implode
If that doesn't work see the troubleshooting steps at the bottom of this page.
Mac OS X Requirements
====================
* Install Mercurial from http://mercurial.berkwood.com/
* Install Xcode Command Line Tools from the App Store.
xcode-select --install
brew update
brew install mercurial
Linux Requirements
==================
Debian/Ubuntu
==================
sudo apt-get install curl
sudo apt-get install git
sudo apt-get install mercurial
sudo apt-get install make
sudo apt-get install binutils
sudo apt-get install bison
sudo apt-get install gcc
sudo apt-get install build-essential
Redhat/Centos
==================
sudo yum install curl
sudo yum install git
sudo yum install make
sudo yum install gcc
sudo yum install bison-devel
sudo yum install glibc-devel
* Install Mercurial from http://pkgs.repoforge.org/mercurial/
FreeBSD Requirements
====================
sudo pkg_add -r bash
sudo pkg_add -r git
sudo pkg_add -r mercurial
Vendoring Native Code and Dependencies
==================================================
GVM supports vendoring package set-specific native code and related
dependencies, which is useful if you need to qualify a new configuration
or version of one of these dependencies against a last-known-good version
in an isolated manner. Such behavior is critical to maintaining good release
engineering and production environment hygiene.
As a convenience matter, GVM will furnish the following environment variables to
aid in this manner if you want to decouple your work from what the operating
system provides:
1. ``${GVM_OVERLAY_PREFIX}`` functions in a manner akin to a root directory
hierarchy suitable for auto{conf,make,tools} where it could be passed in
to ``./configure --prefix=${GVM_OVERLAY_PREFIX}`` and not conflict with any
existing operating system artifacts and hermetically be used by your
workspace. This is suitable to use with ``C{PP,XX}FLAGS and LDFLAGS``, but you will have
to manage these yourself, since each tool that uses them is different.
2. ``${PATH}`` includes ``${GVM_OVERLAY_PREFIX}/bin`` so that any tools you
manually install will reside there, available for you.
3. ``${LD_LIBRARY_PATH}`` includes ``${GVM_OVERLAY_PREFIX}/lib`` so that any
runtime library searching can be fulfilled there on FreeBSD and Linux.
4. ``${DYLD_LIBRARY_PATH}`` includes ``${GVM_OVERLAY_PREFIX}/lib`` so that any
runtime library searching can be fulfilled there on Mac OS X.
5. ``${PKG_CONFIG_PATH}`` includes ``${GVM_OVERLAY_PREFIX}/lib/pkgconfig`` so
that ``pkg-config`` can automatically resolve any vendored dependencies.
Recipe for success:
gvm use go1.1
gvm pkgset use current-known-good
# Let's assume that this includes some C headers and native libraries, which
# Go's CGO facility wraps for us. Let's assume that these native
# dependencies are at version V.
gvm pkgset create trial-next-version
# Let's assume that V+1 has come along and you want to safely trial it in
# your workspace.
gvm pkgset use trial-next-version
# Do your work here replicating current-known-good from above, but install
# V+1 into ${GVM_OVERLAY_PREFIX}.
See examples/native for a working example.
Troubleshooting
===============
Sometimes especially during upgrades the state of gvm's files can get mixed up. This is mostly true for upgrade from older version than 0.0.8. Changes are slowing down and a LTR is imminent. But for now `rm -rf ~/.gvm` will always remove gvm. Stay tuned!