A few words before we start. You can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.

Hello and welcome back to Road to Go Pro. In this story, we are going to talk about how to write unit tests in Go.

Photo by Kelly Sikkema on Unsplash

Unit Test

Developing new features is fun but only doing that is not going to take you very far. Inevitably, you will run into bugs and defects. Tests can help us to surface these…


A few words before we start. You can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.

Thank you for following along the Road to Go Pro. We have learned the basics of Go in the previous tutorials. In this one, we are going to explore packages and modules. When you start to build Go projects, this knowledge will come in handy. Before we begin, I highly recommend checking out the example project in…


Photo by Cris Saur on Unsplash

Disclaimer: This is a story about sleep. I’m not qualified to provide any health advice. So please treat whatever I say below as general information only.

4-hour sleep is enough

One of my ex-colleagues once told me that he only sleeps 4 hours per day and he can get through the day just fine. I was so jealous of him because I need at least 7 hours of sleep every day to be able to get out of my bed in the morning. Time is fair to all beings on Earth. Humans, animals, plants, insects all get 24 hours in a day. Not a…


A few words before we start. You can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.

We talked about flow controls and loops in the last part of the tutorial. In this one, we will cover pointers and functions. After finishing the first 4 parts of Road to Go Pro, you are well equipped to start writing scripts or console applications using Go.

Pointers

Photo by Nathalie SPEHNER on Unsplash

If you have used C or C++, you already know…


A few words before we start. You can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.

We talked about the basic types and data structures in the last part of the tutorial. In this one, we will talk about flow control, loops and thefmt package.

Flow Control

Photo by Igal Ness on Unsplash

if

Firstly, let’s look at the if statement. One of the most basic flow controls is if and else statements. They control the program to execute different code blocks…


Before we start, you can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.

Last but not the least, a special thank you to Mark Hume-Cook for reviewing this article.

Primitive types

Primitive types are the most basic types we use in any programming languages. We’re going to cover the most common four primitive types used in Go. They are boolean, integer, float and string. Let’s get right into it.

Boolean is the simplest primitive type…


What is Go

Gopher

Go is an open-source programming language developed by Google. It is a highly scalable and easy-to-learn language which suits for cloud-native development, serverless computing, edge computing and so on. Go is fairly young, comparing to vastly used Java and C#. But it has become a mainstream language in a very short time. Even one of the four biggest banks in Australia has adopted go in their technology stack.

I worked in projects which used Java/Kotlin and C# as the main programming languages before. Since last December, I started to write Go full time and so far I enjoyed it a…


Entering a dark tunnel

Photo by Nelly Antoniadou on Unsplash

It has been I-forgot-how-many days since I started to work from home in Australia due to COVID-19. Before the government announced the nationwide lockdown, many organisations had asked their employees to work from home. I work for one of the four big banks in Australia, and their actions are usually slower than others. Everyone was hoping we could start to work from home soon and I clearly remember we cheered when we finally received the long-awaited “work from home” email. I truly believed that I would enjoy working from home at that time.

The first a couple of weeks were…


Our lives are more or less impacted by the COVID-19 pandemic by now. No doubt this is a terrible event for all of us and we want to get over it as soon as possible. However, it’s a bit (very) hard to say goodbye to social life entirely and be happy to stay at home for the foreseeable future. So I spent some efforts to “bring” my friends together to play one of our favorite table-top board games, power grid. And of course, we are not physically together, please STAY AT HOME!

Part 1

Australians had a rough start in 2020, a…

Song Xue

Software engineer and tech enthusiast. Consulting at DigIO in Melbourne. A big fan of Go. Enjoy reading, cycling and board-gaming.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store