Getting Used to Go

Jaeeun Cho
4 min readMay 31, 2022

--

Doing some Go coding

Introduction

I used JavaScript and Node.js at projects for last 3 years. I started as Angular developer at my first career, used Node.js in personal projects, and developed TypeScript servers. I really get used to Node.js. Not like guru but I’m sure I can implement many things from it.

After 3 years, I came up with one idea; Like I get used to Node.js and JavaScript, I should revisit “how to get used to some other language and concept”.

Why Go

  • Good for server developing
  • Binary executables
  • Statically typed language

First step was to choose what language to learn. I choose Go. There were couple reason for this.

First reason is that Go is good for server developing. These days, I’m really interested in server application developments and usually do server projects. Why I like to do server programming is there are much different systems to learn. Go has good server developing packages out of box. Compared to Node.js where you should download all the different packages before starting developing servers, Go would be pretty lightweight and not much to learn.

Second is Go outputs binary executables. I usually use Docker to deploy applications to servers since it ensures identical environment for application and it can be used as scalability and availability provider. The problem I experienced with using Node.js + Docker was that final output of Docker image is big. Since Node.js alone is big application, and its application sometimes required a lot of packages, its image sizes sometimes reaches almost half GBs. Compared to that, Go is much better. It usually has 2MB kind of image size when used with BusyBox or Alpine image(most lightweight linux image), makes it simpler to use with Docker.

Finally, I thought I should learn how to use typed language. Dynamic types of JavaScript was useful when dealing structured data with JavaScript Object. However, it also had some tradeoffs of performance and readability. Even if TypeScript provides some typed-like experience, it has limits. Go is static typed language, and I thought it could be a good option to learn how to improve performance and readability using static typed language.

Plans to Do It

  1. Read good docs, watch tutorials, and refer to references
  2. Starting New Project

How should I learn Go? I came up with these;

I like to start leaning new concept from top-down approach, which means starting from conceptual videos and tutorials, and deep down to official documents and other project references. For Go, I personally started with following;

These gave conceptual understanding of Go. I kept on going with deeper docs, tutorials, and reference projects.

  • effective go: Go official document of how to write good Go code
  • project layout: a common project layout repository to reference
  • satellity: a good reference REST API project written in Go

Starting a simple project would be great boost up for learning. After doing some readings written above, I jumped right into projects.

Example of pregression

First project was ‘pregression’, at that time I was doing small project that process some historical data of cryptocurrency and predicts future price. The core was polynomial regression model and I decided to implement it with Go. I will posting ‘pregression’ and the prediction project later.

Example of Bulk Download

Second project was ‘bulk-download’. It is simple web service that takes URL pattern from user and bulk download and zip it to provide download. One friend of mine was suffering from this tedious task, and asked me if I can automate it. So I did.

Conclusion

Now I think I’m ready to do some real projects with Go. Like I said above, I choose Go because it is good for server, it outputs binary when compiled, and it is statically typed language. I did reading and watching docs and tutorials, conducted simple project myself with Go.

I’m currently doing some bigger projects with Go, and also I’m going to post those in another article. Thank you for watching!

Next Story: A Newbie Gopher’s Server Developing Experience

--

--