Skip to content

Instantly share code, notes, and snippets.

@skizhak
Last active March 10, 2017 02:43
Show Gist options
  • Save skizhak/8a72f649a2006203c2fb930d3ff4dfd3 to your computer and use it in GitHub Desktop.
Save skizhak/8a72f649a2006203c2fb930d3ff4dfd3 to your computer and use it in GitHub Desktop.
Go developer environment

Setup

Install GO after downloading from https://golang.org/dl/

Set GOPATH to directory you want to keep your package and source files.

export GOPATH=~/go

Update PATH to add GO binary location

export PATH=~/go/bin:$PATH

go get will fetch package and put it under your $GOPATH/src/ directory

Colloborating multiple developers on same Repo

If you're used to fork repo and submit PR for fixes/updates, the issue with GO based projects is that, source will have import statements with package name path that of original repo. Use following steps to avoid this error while building.

  1. fork the repo
  2. go get original repo
  3. cd $GOPATH/src/
  4. If git remote 'origin' is set, remove it and add remote 'origin' pointing to your fork repo
  5. add remote upstream pointing to original repo to fetch and pull down changes. or any additional remote that you're collaborating with
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment