Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brettlangdon/gopkg
Go environment manager
https://github.com/brettlangdon/gopkg
Last synced: about 1 month ago
JSON representation
Go environment manager
- Host: GitHub
- URL: https://github.com/brettlangdon/gopkg
- Owner: brettlangdon
- Created: 2015-05-09T19:41:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-09T19:52:55.000Z (over 9 years ago)
- Last Synced: 2024-10-12T22:44:55.494Z (3 months ago)
- Language: Shell
- Homepage:
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
gopkg
=====`gopkg` is a helper script for helping you manage your go environment similar to
`virtualenvwrapper` for python, making it easy to keep project third party
dependencies isolated.`gopkg.sh` provides the commands `mkgopkg`, `rmgopkg` and `gopkg` which are used
to create, remove and activate go projects.The first iteration of `gopkg` was written in just a few hours, so no guarantee that it'll work for
everyone on every system. If you experience any issues, please open an issue and
I'd be more than happy to investigate with you.## Setup
Download the latest version of the script.
```bash
mkdir ~/.gopkg
curl -o ~/.gopkg/gopkg.sh https://raw.githubusercontent.com/brettlangdon/gopkg/master/gopkg.sh
```Next modify your `~/.bashrc` or `~/.zshrc` files to include the following
```bash
export GOPKG_REPO=github.com/username
export GOPKG_HOME=~/.gopkg
source ~/.gopkg/gopkg.sh
```### Environment variables
`gopkg` uses the following environment variables
* `GOPATH` - when creating a new package `gopkg` will create a directory for the
source of your package within your `GOPATH`
* `GOPKG_REPO` - when creating a new package `gopkg` will use `GOPKG_REPO` as
the base repository location for your package (e.g. `github.com/username`)
* `GOPKG_HOME` - when creating a new package `gopkg` will create a new directory
in `GOPKG_HOME` to store all third party packages (installed normally via `go
get`) in this directory## Usage
### Creating a new packageTo create a new package use the command `mkgopkg `. This will create
directories (if they do not already exist) at `$GOPATH/src/$GOPKG_REPO/`
and `$GOPKG_HOME/` and will update your `GOPATH` to be
`$GOPKG_HOME/:$GOPATH`.### Removing an existing package
To remove an existing package run the command `rmgopkg `. `rmgopkg` will
only remove the directory created inside of `$GOPKG_HOME/`, it will not
touch the one in `$GOPATH/src/$GOPKG_REPO/`.### Activating a package
Just like `virtualenv` you have to "activate" a package in order to use
it. Running `gopkg ` will activate an existing package. What it does is
simply update your `GOPATH` to be `$GOPKG_HOME/:$GOPATH` and add `()
` to `PS1`.The updated `GOPATH` allows `go get` to install all packages into
`$GOPKG_HOME/` while still being able to successfully find you source
package in `$GOPATH/src/$GOPKG_REPO/`.### Deactivating a package
When you are done and want to reset your `PS1` and `GOPATH` variables simply run
`deactivate`. `deactivate` is a command which is only available once you have
run `gopkg `.