Getting started with Go in Windows
Golang is a programming language introduced by Google in 2009. The reason behind its development is due to frustration at Google, since developers continually had to pick a language that executed efficiently but took a long time to compile, other languages that ran inefficiently in production, but easy to program. Hence, Golang was designed for fast compilation, ease of programming and efficient execution in production.
Go can be used for many different programming projects since it is a versatile programming language. It is well suited for networking/distributed systems programs and widely used in the cloud environment since developers can do more with a strong set of tools and deployment becomes easy since only a single binary must be compiled. Furthermore, Go is easy to learn due to its small set of keywords, which also make a good choice for beginners and experienced developers.
Installing Golang on Windows it’s a very straightforward process
- Just download the Go executable directly from the official Golang website https://golang.org/dl/.
- Choose Microsoft Windows, and the download will starts.
- Run the downloaded executable
Set system environment variable
- Go to control panel -> System -> Advanced system settings
- On Advanced tab click Environment Variable
- If the installation went successful you should see your GOPATH variable.
- In case it does not appear in the list you need to add it.
- Set the GOBIN variable environment
- Set GOROOT variable environment
Set environment folders:
- bin (for binary files)
- pkg (for packages)
- src (for the source codes)
- Open command prompt cmd (win + R then type
cmdand hit enter)
- Type go version and hit enter if it prints your Go version then you are ready to go
- And also type go env and hit enter, it will show your go path and other additional information