Simple bash script for setting up Golang environment

Some time ago, when i just started to use golang, golang project's structure organizing, this magic $GOPATH and other things was strange for me. No, it wasn't bad, just nothing like i have used before. It's simple to understand with erlang, at least for the start, you must just install erlang, to create project, to add rebar with deps and that's all. Something like this with nodejs project bootstraping. There are clear and intuitive package managers which downloads project's dependencies and puts it to the project dir.

Another case with Golang && go get. They are very cool, but not for the first look. You read it's documentation, execute all instructions and than get something like go can't find `projectname` in $GOPATH and $GOROOT. So i created simple bash script which will help you to set up golang environment from the scratch. It makes 3 simple things:
  • Creates directories for Golang compiler and your future projects
  • Downloads golang compiler and builds it
  • Puts golang/bin/ and directory with your projects to $GOPATH
That's all. Very simple. Of course this script is not for a professional golang developers. It's primarily for two points:
  • For newbie gophers
  • For fast setting up golang environment
Here is the script:

Just run this script and pass directory path where will be golang and projects, and your github username. It will create directories for golang and you project. After it you can start to coding.

That's all. If you will have any questions/suggestions/problems with this script write me a comment.

Happy coding :)