Skip to content

Instantly share code, notes, and snippets.

@joaojeronimo
Last active August 29, 2015 14:18
Show Gist options
  • Save joaojeronimo/5942c49f331dcad0406b to your computer and use it in GitHub Desktop.
Save joaojeronimo/5942c49f331dcad0406b to your computer and use it in GitHub Desktop.
Getting Started With Go

Install Go

  • You'll want 1.4.x
  • Don't get it from the package manager (unless you use Arch, brew is also fine)

Setup your environment

Set GOROOT to where Go is installed, GOPATH to where you'll want libraries to be installed and where you'll be working

  • ~/go is a good GOROOT
  • ~/src is a good GOPATH

You would be working on ~/src/github.com/you/project

Importing packages

Imports are always relative to your GOPATH.

	import "github.com/you/project" // is valid
	import "../project" // is not valid

Quickstart for contributing for docker

Get other packages here: https://golang.org/dl/

cd ~
wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzvf go1.4.2.linux-amd64.tar.gz # creates the ~/go folder

mkdir ~/src

No add this to ~/.bashrc:

export GOROOT="~/go"
export GOPATH="~/src"
export PATH="$PATH:$GOROOT/bin"

Tools that will help you

GoSublime and vim-go

For GoSublime, Ctrl+Shift+P, Install Package, GoSublime

For vim-go tips, look at: https://robots.thoughtbot.com/writing-go-in-vim

Now on to some DOCKER CONTRIBUTIONS!

Clone Docker:

git clone [email protected]:docker/docker.git $GOPATH/github.com/docker/docker
cd $GOPATH/github.com/docker/docker
# Make contribution
# PULL REQUEST
# Make next contribution
# PULL REQUEST
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment