Skip to content

Instantly share code, notes, and snippets.

@Omie
Last active August 14, 2023 10:06
Show Gist options
  • Save Omie/8cbf7c39bd00457c08df to your computer and use it in GitHub Desktop.
Save Omie/8cbf7c39bd00457c08df to your computer and use it in GitHub Desktop.
Steps involved in getting started with Go language
Getting started with Go language - documenting steps that I am doing to start with Go language
Installation
------------
Installing Go language from source, because version in Ubuntu repo is too old.
from stackoverflow : http://stackoverflow.com/questions/17480044/how-to-install-the-current-version-of-go-in-ubuntu
There is GVM to maintain different versions of Go (https://github.com/moovweb/gvm)
but someone is saying there are too many dependencies and I don't want to keep
fighting with it.
Official doc to install from source is the best way to go for now.
Following : http://golang.org/doc/install/source
Install C tools on Ubuntu
sudo apt-get install gcc libc6-dev libc6-dev-i386
# libc6-dev-i386 is for 64 bit systems
I did not install mercurial. I downloaded source tarball instead.
from : http://golang.org/dl/
It turns out that if I had used mercurial, I could simply do pull and run all.bash to update to next version.
extract
tar -xvf go1.3.1.src.tar.gz
$ cd go/src
$ ./all.bash
It said all tests passed, and add bin directory to my PATH /opt/go/source/go/bin
Added following line to my ~/.bashrc
PATH=$PATH:/opt/go/source/go/bin
tested hello.go
"hello, world!"
Install go tools (need mercurial installed)
go get code.google.com/p/go.tools/cmd/godoc
Setting up environment
----------------------
Following : http://golang.org/doc/code.html
- explains the standard way to fetch, build, and install Go packages and commands
Further reading
---------------
http://golang.org/cmd/go/
http://golang.org/doc/effective_go.html
http://tour.golang.org/
https://gobyexample.com/ //<< this is good
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment