Go tools are awesome

gotools

Yes, they are. And that’s why I love Go. Almost all important tools come together with Go installation, but there are also some you can install additionally depending on your needs: golint, errcheck, etc.

Snake over Telnet in Go

Telnet games were very popular some time ago, especially this Star Wars movie: telnet towel.blinkenlights.nl.

I wanted to create something in Go, and I wrote this Snake game over Telnet.

Slack Stranger Bot in Go

wizeline-random.png

I am enjoying writing programs in a short time, like in a Hackathon way. Here in Vietnam we don’t have Hackathons often, so yesterday I decided to make one for myself with a time limit in 3 hours. The goal was to build/deploy something that will work and people can try it. I decided to go with Bot for Slack (or another messenger in the future).

Benchmarking gRPC+Protobuf vs HTTP+JSON in Go

grpc-json.png

Simplest possible solution for communication between services is to use JSON over HTTP. Though JSON has many obvious advantages - it’s human readable, well understood, and typically performs well - it also has its issues. In the case of internal services the structured formats, such as Google’s Protocol Buffers, are a better choice than JSON for encoding data.

Garbage Collection in Git

git-gc

To understand git garbage collector, we need to understand how branches work. Branches are just pointers to commits that move whenever a new commit is created.

Using different Git emails

Usually at work and at home we use different Git name/email pairs, or even per project. Pushing with correct email guarantees that your commits will be authored with a correct user identity.

Working with DB datetime/date columns in Go

This post shows how to work with DATETIME / DATE database columns and use Go standard time.Time avoiding manual string parsing. This article contains examples using 2 packages: database/sql and github.com/go-sql-driver/mysql.

Multi-stage Dockerfile for Golang application

multi-stage

A common workaround for building Golang application in Docker is to have 2 Dockerfiles - one to perform a build and another to ship the results of the first build without tooling in the first image. It called Builder Pattern.

Useful Git global config and ignore rules

git-pretty-log

I am working with git every single day, from different machines and accounts. And all these hosts have the same global git configuration. I sync it using tiny bash script.

Different ways to block Go runtime forever

The design of Go’s runtime assumes that the programmer is responsible for detecting when to terminate a goroutine and when to terminate the program. Normally, a program can be terminated in a normal way by calling os.Exit or by returning from the main() function. There are a lot of ways of blocking runtime forever, I will show all of them for better understanding of blocking in Go.