First of all Happy New year to all. Great now we should be having a good start for the year 2014. So coming to the point. Being a developer I have worked on server languages and tools, naming ruby, rails, javascript, titanium, mongodb a few.
I also heard about some good languages coming out of womb, some looked very promising like go, elixir(runs on Erlang virtual machine) and julia. I started exploring, because of my curiousity and really hooked to them. Go is one of them that I also dared to use in production, and to my surprize it kept its promise. This special series will cover go language(from whichever perspective).
Go is a C like language, developed with keeping current system requirements and capabilities in mind, it has a robust memory management, garbage colletion, concurrency(via goroutine or coroutines actually). If you would like to read into details look into Go and wiki. It is not a OOPS language as paradigm is sifting back to functional and imperative languages.
Install it
Go get package for your operating system and install it from Golang Installation Page, export go executables to path.
you should be able to check if go has installed correctly by typing following in console
Now next step is to setup a GOPATH
, GOPATH is a directory where all go code dependencies; that one installs, resides. It also contains go projects that one builds. So GOPATH
has to be set before we move on.
Let’s set it up somewhat like this in bash profile
Every go project has a directory layout, as mentioned below
$GOPATH
|
|--- src/**/*.go # contains source code of go projects
|
|--- pkg
| |--- $GO_ARCH/*.a #contains go project objects
|
|--- bin #contains all binaries of installed go project
Go also has a very interesting third party packages integration tool called go get
. It also detects popular vcs tools like git and integrates well with github. Here is an example for getting mongodb driver called mgo
Now we are all set. So let’s start with our first code. Navigate to GOPATH directory under src
create a new directory, name it hello_gopher
and then make a file called hello_gopher.go
Happy Coding ;)
About The Author
I am Pankaj Baagwan, a System Design Architect. A Computer Scientist by heart, process enthusiast, and open source author/contributor/writer. Advocates Karma. Love working with cutting edge, fascinating, open source technologies.
To consult Pankaj Bagwan on System Design, Cyber Security and Application Development, SEO and SMO, please reach out at me[at]bagwanpankaj[dot]com
For promotion/advertisement of your services and products on this blog, please reach out at me[at]bagwanpankaj[dot]com
Stay tuned <3. Signing off for RAAM