Thursday, August 15, 2013

Installing and Configuring Go


In preparation for a few beginner workshops, I created videos for people to follow to install and configure the Go development tools. Just adding them here.

On Mac OSX:


On Ubuntu Linux:


The steps that I've followed are pretty much this (with my username 'vj'):
  • Download the zip or .tar.gz file for your platform from https://code.google.com/p/go/downloads/list
  • Create a folder called golang wherever you prefer. I prefer to have it in my home folder like so: /home/vj/coding/golang since I want to keep all my programming language folders in a "coding" folder in my home dir.
  • Extract the .zip or .tar.gz file you downloaded earlier. It will contain a single "go" folder. Move this into your golang folder. So you will now have something similar to /home/vj/coding/golang/go
  • Append the path to the go command line tools (/home/vj/coding/golang/go/bin) to your $PATH. On Ubuntu in my bash shell, to ~/.bashrc I added the entry export PATH=$PATH:/home/vj/coding/golang/go/bin
  • I created one new folder in the golang folder called gopath". The Go tools will have use for this path later to download and install external packages.
  • Add two additional entries to your .bashrc, export GOROOT=/home/vj/coding/golang/go and export GOPATH=/home/vj/coding/golang/gopath
  • Source the .bashrc if required so that the environment variables are available in your current shell, or restart the shell.

With that you should now be ready to compile and run your go programs. Note that you don't need any special editors or IDEs to work with Go. All your regular text editors will work.
The process to be followed for Windows is pretty much the same. You can have your golang folder as c:/coding/golang and add your environment variables as you would normally do on windows: right click My Computer -> Click Properties -> Click Advanced System Settings -> Click Environment Variables. Add new GOROOT and GOPATH values, and append the required value to the Path variable.

43 comments:

  1. Kudos!!! for creating such a great education site.

    ReplyDelete
  2. I'm a new mac user. I added the GOROOT and GOPATH environment variables when I started learning Golang few days ago. But now when I echo $GOROOT and $GOPATH it's returning blank. Also tried these steps:

    touch .bash_profile
    open -a TextEdit.app .bash_profile
    export GOROOT=/home/my_coding_dir/coding/golang/go


    So can you explain more about these two points, in the sense that why am I seeing this behaviour?

    1) Add two additional entries to your .bashrc, export GOROOT=/home/my_coding_dir/coding/golang/go and export GOPATH=/home/my_coding_dir/coding/golang/gopath

    2) Source the .bashrc if required so that the environment variables are available in your current shell, or restart the shell.


    What am I doing wrong here?

    ReplyDelete
  3. By the way this did not help either:

    touch .bashrc
    open -a TextEdit.app .bashrc
    export GOROOT=/home/my_coding_dir/coding/golang/go

    ReplyDelete
  4. For ubuntu just use...

    sudo apt-get install golang

    ReplyDelete
  5. I cant wait to check out some of these blogs! I’ve really wanted to start learning more about cars and auto repairs lately and I think this will help a lot. I think it can save my family some money if we knew how to do some repairs at home.! Thanks again for all the options.

    bike spa services in mumbai
    house cleaning services in mumbai
    car wash services in mumbai

    ReplyDelete
  6. It is really a great and useful piece of info. I’m glad that you shared this helpful info with us. Please keep us informed like this. Thank you for sharing.
    Back to original

    ReplyDelete
  7. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    Digital Marketing Company in India

    ReplyDelete
  8. I just see the post i am so happy to the communication science post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be replay for your great thinks and I hope you post again soon.

    Salesforce Training in Chennai

    ReplyDelete

  9. I definitely think that this should be well thought out and done in a smart way, it is important to get out there and market your business.

    This is a great information and examples, thanks for sharing!



    digitalbrief exchange digital marketing

    ReplyDelete
  10. Big Data and Data Science Course Material. Avail 15 Day Free Trial! Learn Flume, Sqoop, Pig, Hive, MapReduce, Yarn & More. Get Certified By Experts!
    android app development training

    ReplyDelete
  11. Thank you for sharing them! I hope you will continue to have similar posts to share with everyone!
    html color

    ReplyDelete
  12. Thanks for your article! I have been looking for quite a long time and fortunately I read this article! I wish you would continue to have valuable articles like this or more to share with everyone!
    abcya

    ReplyDelete
  13. Really Good blog post.provided a helpful information about how to install and configure golang .keep updating...
    Digital marketing company in Chennai

    ReplyDelete
  14. I hope you will continue to have similar posts to share with everyone! scorehero.net

    ReplyDelete
  15. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Installment loans
    Payday loans
    Title loans
    Cash Advances

    ReplyDelete
  16. I hope you will continue to have similar posts to share with everyone! stick-rpg2.com

    ReplyDelete
  17. I enjoyed over read your blog post. Your blog have nice information, I got good ideas from this amazing blog. I am always searching like this type blog post. I hope I will see again
    FRIV 8 & FRIV 8 Games
    Friv 9 - Friv - Friv Games
    FRIV20 GAMES

    ReplyDelete
  18. I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.

    ReplyDelete
  19. Your article is awesome! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone! I believe there will be many people who share my views when they read this article from you!
    vex 3

    ReplyDelete
  20. Really Good blog post.provided a helpful information about installing and configuring go.I hope that you will post more updates like this.
    MSBI Training in Chennai

    ReplyDelete
  21. I like your post. It really useful with me. Thanks for sharing these useful information!
    happywheels3game.com

    ReplyDelete
  22. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.


    Pawn Shop

    Pawn Loans

    Pawn Shops

    Pawn Loan

    Pawn Shop near me

    ReplyDelete
  23. Thanks for the information you shared. Please share useful information with your friends regularly
    papasgamesonline.com

    ReplyDelete
  24. I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job! In my free time, I like play game: facebooklite.com.br. What about you?

    ReplyDelete
  25. This is a great article. It gave me a lot of useful information. thank you very much.

    www.appbaixar.com

    ReplyDelete
  26. Thank you, so Much admin have a nice day :) you information about weight loss is very easy and simple.
    pocafashion

    ReplyDelete
  27. Thank you very much for the information you shared, it’s all I’ve been looking for
    www.happywheels-2.com

    ReplyDelete
  28. I realize that nothing is fair but I'm still trying. I just want to do my best and what is possible
    povaup

    ReplyDelete
  29. Hello, just wanted to say, I loved this article. It was practical.
    potaca.com

    ReplyDelete
  30. I appreciate you and hopping for some more informative posts. thanks for share
    run3.run

    ReplyDelete
  31. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
    http://b612az.com

    ReplyDelete
  32. If your are looking for the services of Facebook Marketing in Lahore . Really good Blog i appreciate your hard work and research. Very helpful information. Try Marketing92 to Meet Your Requirement. Our Branded SMS in Lahore Services will help you to Increase Your customer and sales.

    ReplyDelete
  33. I have read your article, the information you give is very interesting.
    instagram viewer

    ReplyDelete
  34. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  35. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete

If you think others also will find these tutorials useful, kindly "+1" it above and mention the link in your own blogs, responses, and entries on the net so that others also may reach here. Thank you.