• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H20-Jan-2016-12797

test/H20-Jan-2016-255182

.gitignoreH A D20-Jan-201641 76

.travis.ymlH A D20-Jan-201689 54

CONTRIBUTING.mdH A D20-Jan-20161.1 KiB2319

Godeps.sampleH A D20-Jan-2016350 149

LICENSEH A D20-Jan-20161.1 KiB2217

MakefileH A D20-Jan-2016223 149

README.mdH A D20-Jan-20169.9 KiB221142

configureH A D20-Jan-2016732 5042

README.md

1# Go Package Manager [![Build Status](https://travis-ci.org/pote/gpm.png?branch=master)](https://travis-ci.org/pote/gpm)
2
3gpm is a minimalist package manager for Go that leverages the power of the `go get` command and the underlying version control systems used by it to set your Go dependencies to desired versions, thus allowing easily reproducible builds in your Go projects.
4
5Go Package Manager makes no assumptions about your dependencies and supports Git, Bazaar and Mercurial hosted Go packages, for a smoother workflow be sure to check out [gvp](https://github.com/pote/gvp) - the Go Versioning Packager which  provides dependency isolation for your projects.
6
7<div align="center">
8  <img src="./gpm_logo.png">
9</div>
10
11#### gpm + [gvp](https://github.com/pote/gvp) sample usage:
12
13![gpm + gvp](./gpm_install.gif)
14
15## Installation options
16
17### In OSX with Homebrew
18
19```bash
20$ brew install gpm
21```
22
23### In Arch Linux - AUR
24
25```bash
26$ yaourt -S go-gpm
27```
28or
29
30```bash
31$ packer -S go-gpm
32```
33
34Caveat: you'll use `go-gpm` instead of just `gpm` in the command line, as there is a general purpose linux package under that name already.
35
36### Manually with a one-liner
37
38Latest stable release:
39
40```bash
41$ wget https://raw.githubusercontent.com/pote/gpm/v1.4.0/bin/gpm && chmod +x gpm && sudo mv gpm /usr/local/bin
42```
43
44### Manually on *nix
45
46```bash
47$ git clone https://github.com/pote/gpm.git && cd gpm
48$ git checkout v1.4.0 # You can ignore this part if you want to install HEAD.
49$ ./configure
50$ make install
51```
52
53### Use directly from GitHub
54
55As gpm is a bash script you can always use it directly from GitHub via `wget` or `curl`, this is particularly useful for CI servers and other automated environments.
56
57```bash
58## With wget
59$ wget -qO- https://raw.githubusercontent.com/pote/gpm/v1.4.0/bin/gpm | bash
60
61## With cURL
62$ curl -s https://raw.githubusercontent.com/pote/gpm/v1.4.0/bin/gpm | bash
63```
64
65## The Godeps file
66
67`gpm` expects you to have a file called `Godeps` in the root of your Go application in the format `<import path> <tag/revision>`.
68
69Once this file is in place, running the `gpm` tool will download those packages and check out the specified versions.
70
71#### Packages
72
73You can specify packages with the `<import path> <version>` format, where `version` can be a revision number (a git/bazaar/mercurial/svn revision hash) or a tag.
74
75```bash
76$ ls .
77Godeps  foo.go  foo_test.go
78
79$ cat Godeps
80github.com/nu7hatch/gotrail               v0.0.2
81github.com/replicon/fast-archiver         v1.02
82launchpad.net/gocheck                     r2013.03.03   # Bazaar repositories are supported
83code.google.com/p/go.example/hello/...    ae081cd1d6cc  # And so are Mercurial ones
84
85
86```
87
88
89#### Comments
90
91The Godeps file accepts comments using a `#` symbol. Everything to the right of a `#` will be
92ignored by gpm, as well as empty lines.
93
94
95#### Extensibility
96
97As a convention comments can be used to specify lines that gpm core should ignore but are instead intended to affect how a given [gpm plugin](#plugins) behaves.
98
99For example: a hypothetical `gpm-track` plugin that makes sure a given package is always updated to its last possible version would leverage a line like this one:
100
101```bash
102#[gpm-track] github.com/nu7hatch/gotrail
103```
104
105This convention makes the Godeps file format extensible, just as with plugins this can help identify common needs that might later on be merged into core without having to sacrifice code simplicity in order to explore new features.
106
107#### Private Repos
108
109Both gpm and `go get` support using private GitHub repositories! Here's what you need to do in order for a specific machine to be able to access them:
110
111* Generate a GitHub access token by following [these instructions](https://help.github.com/articles/creating-an-access-token-for-command-line-use/).
112* Add the following line to the `~/.netrc` file in your home directory.
113
114```bash
115machine github.com login <token>
116```
117
118You can now use gpm (and `go get`) to install private repositories to which your user has access! :)
119
120#### Completeness
121
122It is recommended to keep a healthy and exhaustive `Godeps` file in the root of all Go project that use external dependencies, remember every package that you add to the Godeps file will be installed along with its dependencies when gpm runs `go get` on it, so if you don't include these dependencies in your Godeps file you are losing the ability to reproduce a build with 100% reliability.
123
124Make sure your Godeps file is exhaustive, this way any project includes the documentation required to be built reliably at any point in time.
125
126### Commands
127
128gpm has the following commands:
129
130```bash
131$ gpm             # Same as 'install'.
132$ gpm get         # Parses the Godeps file, gets dependencies and sets them
133                  # to the appropriate version but does not install them.
134$ gpm install     # Parses the Godeps file, installs dependencies and sets
135                  # them to the appropriate version.
136$ gpm version     # Outputs version information
137$ gpm help        # Prints this message
138```
139
140### Plugins
141
142As of version [v1.1.1](https://github.com/pote/gpm/releases/tag/v1.1.1) gpm supports plugins, the intent of which is the ability to add powerful non-core features to gpm without compromising the simplicity of its codebase.
143
144The way gpm plugin works is simple: whenever an unknown command is passed into gpm it will look for an executable in your `$PATH` called `gpm-<command>` and if it exists it will run it while passing all extra arguments to it, simple yet powerful.
145
146This brings a lot to the table: plugins can be written in anything, they can be Go binaries, bash scripts, Ruby gems, Python packages, you name it. gpm wants to make it easy for you to extend it. :)
147
148#### Installing plugins through Homebrew
149
150I maintain a [repository with homebrew formulae for gpm plugins](https://github.com/pote/homebrew-gpm_plugins) that you can add to your system with the `brew tap` command:
151
152```bash
153$ brew tap pote/gpm_plugins
154```
155
156After you've done this you can install plugins as you would with any other homebrew packge.
157
158```bash
159$ brew install gpm-bootstrap
160```
161
162#### Known Plugins
163
164If you have written a gpm plugin and want it included please send a pull request to the repo! I love how people have taken to explore possible features using plugins so if you've written one there is about a 99% chance I will include it here. :)
165
166| Name and Link                   | Author                               | Short Description                 | Type        |
167|:-------------------------------:|:------------------------------------:|:----------------------------------|:-----------:|
168| [gpm-bootstrap][plugin-boot]    | [pote][author-pote]                  | Creates an initial Godeps file    | official    |
169| [gpm-git][plugin-git]           | [technosophos][author-technosophos]  | Git management helpers            | third party |
170| [gpm-link][plugin-link]         | [elcuervo][author-elcuervo]          | Dependency vendoring              | third party |
171| [gpm-local][plugin-local]       | [technosophos][author-technosophos]  | Usage of local paths for packages | third party |
172| [gpm-prebuild][plugin-prebuild] | [technosophos][author-technosophos]  | Improves building performance     | third party |
173| [gpm-all][plugin-all]           | [pote][author-pote]                  | Installs multiple sets of deps    | official    |
174| [gpm-lock][plugin-lock]         | [zeeyang][author-zeeyang]            | Lock down dependency versions     | third party |
175
176There is no real difference on official/third party plugins other than the willingness of the gpm core team to support each, plugins labeled as third party will be supported (or not) by their authors.
177
178[plugin-boot]: https://github.com/pote/gpm-bootstrap
179[plugin-git]: https://github.com/technosophos/gpm-git
180[plugin-link]: https://github.com/elcuervo/gpm-link
181[plugin-local]: https://github.com/technosophos/gpm-local
182[plugin-prebuild]: https://github.com/technosophos/gpm-prebuild
183[plugin-all]: https://github.com/pote/gpm-all
184[plugin-lock]: https://github.com/zeeyang/gpm-lock
185
186[author-pote]: https://github.com/pote
187[author-technosophos]: https://github.com/technosophos
188[author-elcuervo]: https://github.com/elcuervo
189[author-zeeyang]: https://github.com/zeeyang
190
191
192### Further Reading
193
194The creator for the [gpm-git](https://github.com/technosophos/gpm-git) and [gpm-local](https://github.com/technosophos/gpm-local) wrote a [fantastic blog post explaining the usage and rationale](http://technosophos.com/2014/05/29/why-gpm-is-the-right-go-package-manager.html) of gpm and [gvp](https://github.com/pote/gvp), it sums up explanations for several of the design decisions behind both tools.
195
196### Contributing
197
198Lots of people have contributed to make gpm what it is today, if you want to take your time to play around
199with the code please do so! Opening issues on bugs, feature requests or simple food for thought are a great
200way to contribute, if you send a pull request please be a good citizen and do things in a tidy manner.
201
202* Create a feature branch with a meaningful name.
203* Make sure your commit messages and PR comments are informative.
204* Write a test for your feature if applicable.
205* Always remember to run the test suite with `make test` before comitting.
206
207Either way, thank you **very** much for any form of contribution, even if a patch ends up not being merged
208the fact that it was sent and forced us to think about it is a contribution in itself.
209
210## License
211
212Released under MIT License, check LICENSE file for details.
213
214## Authorship/Inspiration/Hugs
215
216This tool is inspired by Ruby's [dep gem](http://cyx.github.io/dep/) - authored by [@cyx](http://cyx.is/) and [@soveran](http://soveran.com/), big thanks to them and to all the contributions made by the many wonderful people in our [contributors page](https://github.com/pote/gpm/graphs/contributors).
217
218gpm is maintained by [@pote](https://github.com/pote) and [@elcuervo](https:/github.com/elcuervo).
219
220Go Package Manager evolved from [Johnny Deps](https://github.com/VividCortex/johnny-deps), a tool I wrote for internal use of Vivid Cortex and which is now maintained by the Vivid Cortex team.
221