Summary of 2019
This is the very first time I write a summary of a year. I feel that today is the day I should start doing it and that some digits may be interesting for some people. The biggest change I made this year was changing the blogging platform to Hugo and focused more on Go content. I continued organizing GoCracow meetup. This helped me become a Google Developer Expert in Go category.
I want to learn Go - how to start?
You can find a lot of materials about Go (including this blog) but it’s hard to find the best place to start. This article’s goal is to sum up the most valuable materials I found to help others. I focus only on free materials. Fundamentals The Go tour - IMO the absolutely must do. You can try Go without installing it. You’ll learn some basic syntax and concepts step by step, Go by example - if you’re confused how to use a certain part of the language it’s possible you’ll find an example of it on this page.
Writing a reverse proxy in Go
Some time ago, I found a video called Building a DIY proxy with the net package. I recommend watching it. Filippo Valsorda builds a simple proxy using low-level packages. It’s fun to watch it but I think it’s a bit complicated. In Go, it has to be an easier way so I decided to continue writing series Go In Practice by writing a simple but yet powerful reverse proxy as fast as it’s possible.
Writing TCP scanner in Go
Go is perfect for network applications. Its awesome standard library helps a lot in writing such software. In this article, we’ll write a simple TCP scanner in Go. The whole programm will take less than 50 lines of code. Before we’ll go to practice - a little theory. Of course, the TCP is more complicated than I describe but we need just basics. The TCP handshake is three-way. Firstly, the client sends the syn package which signals the beginning of a communication.
Golang Tips & Tricks #7 - private repository and proxy
In Go 1.13 all modules are provided using a proxy. The proxy caches dependencies what helps to make sure that the version of an external dependencies will never change. If the vendor remove the version and create a new one with the same version, only the first one will be provided. Proxy improves the performance of downloading dependencies as well so it’s useful to have such functionality in the ecosystem.
How I organize packages in Go
Structuring the source code can be as challenging as writing it. There are many approaches to do so. Bad decisions can be painful and refactoring can be very time-consuming. On the other hand, it’s almost impossible to perfectly design your application at the beginning. What’s more, some solutions may work at some application’s size and should the application develop over time. Our software should grow with the problem it’s solving.
Golang Tips & Tricks #6 - the _test package
Testing is one of the hardest stuff in programming. Today trick will help you organize your tests and the production code. Let’s assume you have a package called orders. When you want to separate the package for tests from the production code you can create a new folder and write tests there. It will work but there’s a more clearer way - put your tests to the folder with you package but suffix the package’s name in tests with _test.
Golang Tips & Tricks #5 - blank identifier in structs
While working with structures, there’s a possibility to initialize the structure without providing the keys of fields. type SomeSturct struct { FirstField string SecondField bool } // ... myStruct := SomeSturct{"", false} If we want to force other (or even ourselfs) to explicitly providing the keys, we can add _ struct{} in the end of the structure. type SomeSturct struct { FirstField string SecondField bool _ struct{} } // COMPILATION ERROR myStruct := SomeSturct{"", false} The code above will produce too few values in SomeSturct literal error.
GoGoConf 2019 - report
Recently I’ve been on the GoGoConf conference in Cracow. It was a cool opportunity to learn more and meet interesting persons. Today I’ll tell you about my thoughts regarding every talk from 2019 edition. Most of the talks don’t have video available yet but when the videos will be published I’ll update the post. Tackling contention: the monsters inside the ’sync.Locker’ - Roberto Clapis I personally like Roberto a lot for the way he behaves and how professional he is.
Software 2.0
There are, at least, two excellent articles about Software 2.0. Andrzej Karpathy and Carlos E. Perez wrote blog posts which cover the topic. In this article, I will explain how I understand the term “Software 2.0” what, I hope, will give you a different point of view on the main topic. Software 2.0 is a set of three things which combined complement each other: tools, people, and process. All of them relates to each other closely.