Coder Social home page Coder Social logo

goenv's Introduction

goenv - Set up a Golang environment

I got tired of manually setting my GOPATH when I went from one project to another, so I wrote a small utility to set up my environment for me. It is similar in spirit to Python's virtualenv, though it does less, and does it a little differently.

The main difference is that instead of an 'activate' script that sets up your environment, this opens up a new subshell for you to work in. It will also download and install the version of Go that you want it to.

Installation

It is a single Python script, so you can just make it executable and put it somewhere in your path.

# you might need to add --no-check-certificate to the wget command...
$ wget -O ~/bin/goenv https://raw.github.com/pwoolcoc/goenv/master/goenv
# for the love of pete, don't just run scripts you get from the internet, check them first!
$ $EDITOR ~/bin/goenv
$ chmod +x ~/bin/goenv

Usage

$ cd /path/to/project
$ echo $GOPATH

# simplest usage
$ goenv
Downloading http://go.googlecode.com/files/go1.2.linux-amd64.tar.gz
Extracting /home/user/.cache/goenv/go1.2.linux-amd64.tar.gz to /home/user/.config/goenv/dists/1.2
(golang-1.2) $ echo $GOPATH
/path/to/project:/path/to/project/pkg/somepkg
^D
$

# You don't have to download a new go tarball every time...
$ goenv
Using existing tarball
Go version 1.2 already exists, skipping extract
(golang-1.2) $
^D
$

# specify Golang version
$ goenv --go-version 1.1
Downloading http://go.googlecode.com/files/go1.1.linux-amd64.tar.gz
Extracting /home/user/.cache/goenv/go1.1.linux-amd64.tar.gz to /home/user/.config/goenv/dists/1.1
(golang-1.1) $

Contact

email: [email protected]

twitter: @pauldwoolcock

jabber: [email protected]

goenv's People

Contributors

pwoolcoc avatar m0sth8 avatar pkoch avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.