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 columns in DB 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.

How to build Go plugin with data inside

Go 1.8 gives us a new tool for creating shared libraries, called plugins! This new plugin buildmode is currently only supported on Linux. But what if we build plugin with data in binary format inside? So we can ship only one .so file.

How to use go-bindata with html/template

What is go-bindata and why do we need it?

go-bindata converts any text or binary file into Go source code, which is useful for embedding data into Go programs. So you can build your whole project into 1 binary file for easier delivery.

gh: a tiny tool to manage GitHub repositories in your GOPATH

As a Golang developer I have to clone a lot of packages/tools/etc into $GOPATH/src/github.com. Sometimes I do go get, sometimes it’s necessary to do a combination of mkdir + git clone. So to save my time I wrote a tiny function gh, that actually is the same as cd thatbut also can close repo if it doesn’t exist.