Posts Tagged Under: golang

Functions are a block of code that can call in your code. Functions and Packages are the 2 main ways used for organising code in Golang. You can feed parameters to functions and functions can also return values. You can call one function from inside another function.

Before you can start writing Golang code. You first need to set up a Workspace. A workspace is just a folder that will store all your Golang related stuff. In my case I’ll create a workspace called ‘go_project’:

$ mkdir /root/go_project

A workspace needs to have 3 top level folders called pkg, bin, and src:

Windows Install tips

What is Golang?

Golang (aka G0) is a relatively new programming language Google that has taken the IT world by storm. It was released in 2009 and already some of the biggest applications are written in Go, including Docker, Terraform, and Kubernetes.

This is a series of bitesize tutorials that’ll help you get comfortable with using Golang. This course also requires you to have some experience with Linux, especially using the Bash terminal.

What makes Golang so great?

There’s a lot to like about Golang, here are some of the main reasons why Golang has become so popular:

It’s a general purpose language – meaning that it can can be used for writing low level OS level components, which is usually done in C or C++. It’s also create for developing high level

Once you’ve installed Golang and set up your workspace, you’re now ready to write your hello world go program. Your Go code has to be written in the src folder, and the file needs to have the ‘.go’ extension. So I created the following file:

There are 2 types of Go projects you can create. One is a shared library project which is code that’s used as part of other Golang projects. The other is where the end product of a Golang project is a standalone executable binary.

The package main tells Golang that this project will be creating a standalone executable binary. Next, we declared a function called ‘main’. You