Why GO?
- For a simpler reason, because it’s new, free and open-source.
- Most of the time my boss asks me to work on new technology when it’s not new to market and others are praising it… (then I give him the advantages and dis-advantages if we use that)
- Let me list down few benefits
- Crisp
- Clean and effective
- Fast
- Awesome con-currency mechanism
- And many more...
Attraction
- Main attraction : Open-source
- Performance wise, it utilize the maximum capacity of hardware
- Interface mechanism
- Reflection
- Fast compilation and Quick conversion to machine code
- Type system : awesome
- Neat and modular
- ETC... ETC... ETC...
Let's start learning Go Language (golang)
- To begin with GO, first of all you need to have Go framework installed on your computer.
- Visit - https://golang.org/dl/
- Download the version best suited for your application
- At the time of installation, just note down the path where you are installing it
- In installation, it is just un-zipping the framework files. Go ahead an take look, open any file (its open-source…)
Configuration...
- Go compiler uses two environment variable
- GOROOT : set the value where you installed your go framework
- GOPATH : set the value where you are working
- For example, in our windows systems, we used to install it in
- C:\Go folder and work in D:\Go folder so,
- GOROOT = C:\Go
- GOPATH = D:\Go
- That’s all… Our primary set-up for Go-Language is done
First Small Run...
- Let’s make a basic, “Hello World.” console application.
- Open a notepad and write below mentioned things in there.
- Save it as helloworld.go in (GOPATH)/Src/ folder
- In our case, it'll be "D:\Go\Src\helloworld.go"
Try Getting Output...
- Open the command prompt and browse to that directory where this file is stored (and also configured as GOPATH)
- Now, run bellow mentioned command
- go install
- It will compile and create an executable file in bin folder (created as a sibling to Src folder)
- Try executing this file and you’ll get "Hello, world."

No comments:
Post a Comment