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 this repository (Part 05). …


Image for post
Image for post
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 second more, not a second less. If a person only needs 4 hours of sleep each day, that means they get to do a lot more than those who sleep 8 hours. …


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

Image for post
Image for post
Photo by Nathalie SPEHNER on Unsplash

If you have used C or C++, you already know what’s a pointer. However, in the most popular programming languages like Java, C#, Javascript, Python, etc. there’s no explicit syntax to represent pointers. I had no idea what it is when I first heard of this name. …


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

Image for post
Image for post
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 based on conditions. …


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

Boolean is the simplest primitive type. It has only two possible values, true and false. …


What is Go

Image for post
Image for post
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 lot. …


Entering a dark tunnel

Image for post
Image for post
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 indeed excellent. I drove to work to avoid public transportation. Therefore, I happily took the hours spent on commuting back and reallocated them to sleep in the morning. Apart from that, I have much better work setup, such as a larger monitor and stand desk, at home. …


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 long and devastating bush fire took many precious things away from us, firemen, houses, wildlife, trees and the list goes on. Not long after we finally got over the disaster, a pandemic hit us again and this time, we lost even more lives. COVID-19 has been spreading wildly across the globe and there’s no sign of it slowing down at the moment. Most of the impacted countries have imposed some kind of rules to help stopping the spread. Australia is currently in stage 3 lock down, which means all of us should stay at home and avoid going out. No pubs, no friends gathering, no overseas travel. It’s quite hard to get used to this new way of living. Before all of these, I longed for working from home because I have better setup at home than in the office. Whereas after two weeks of working from home, I kinda miss everything I had in the office, especially human interactions, badly. …


Let’s talk about my LEGOs first

In 2017, I started to invest in LEGO, which in my opinion is a kind of alternative investment. Some of the famous Star Wars sets performed amazingly in the secondhand market. Fans are willing to pay thousands to buy a discontinued set even if it’s not sealed and brand new. Those crazy numbers got me excited, so without adequate research beforehand, I jumped right into this market and started to collect LEGO sets.

Image for post
Image for post

Things went pretty well in the first a couple months, I managed to hunt some cheap sets from eBay and resold it on the Facebook marketplace quickly. As I got deeper into collecting sets, sales began to slow down and I realised that I overestimated the investment margin and liquidity. Not long after I realised these, I became more cautious about picking sets to collect and resell. …

About

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