Wednesday, December 31, 2014

Get Started with Golang - Google Go Programming Language

From last couple of months, I heard loads of buzz around Google Go Programming Language (Golang). I decided to give it a try and must say that it has the potential to disrupt the existing languages like Java, C# and C++. 

Moreover, with the latest release of Go 1.4 on December 2014, it is now possible to write Android apps using Go code. Would Java on Android take a backseat? It's too early to predict that but given the rivalry between Google & Java, Google would definitely want this to happen sooner than later.

Step wise installation of Google Go on Windows OS.

Go to https://golang.org/dl/
Download the required *.msi file for your Windows version. I am currently using Windows 8.1 and hence have downloaded the 64 bit architecture. The file I downloaded is highlighted in the following image. It is a 51.4 MB file. You can download the *.zip file as well but that might require manual intervention from you to set the environment.





Open the *.msi file and follow the prompt (next, next...). If I remember correctly, the *.msi file hardly took ~ 5 minutes to finish up with the installation on my Windows 8.1 machine with intel Core i7 processor.

You may encounter the following screens while installation. Default installation location for Go distribution is in your root directory i.e. C:\Go as shown in below image.




Following image, installation in progress.



Test the installation

1. Open Notepad.
2. Copy paste the following code:


package main

import "fmt"

      func main() {
      fmt.Printf("Hello world! from Basant")
 }

To see that Go supports UTF-8 characters well run a modified version of the above code in Go Playground
     
3. Save the file in C:\Go and name it as hello.go
4. Open Command prompt. ( Press windows+R and type cmd)
5. Move to Go directory as shown below and enter go run hello.go as shown below:


6. If you get the desired strings printed you are all set to sail through your new journey of Go (Golang)

Hapy New Year - 2015 & Happy Learning.
Let us Go...

No comments:

Post a Comment