Golang

MYSQL timestamps in Go

Simple but handy Formatting time in Go is a very interesting topic but let’s focus on a particular case: a popular TIMESTAMP format used in MySQL: ‘0000-00-00 00:00:00’. It turns out that if you want to use it in Go, you have to format time yourself. Luckily it’s a very easy job in Go. Let’s take current time: t := time.Now() fmt.Println(t) This will result in displaying time in the following format:

Continue reading

Introduction to Docker container networking

Build your network of containers There’s a lot of tutorials showing how to link containers using the docker run –link option, but the link flag is a depricated feature of Docker and may be eventually removed. I will show you how to link containers via docker network providing a template of Dockerfile for your Golang application, but the focus here is really on the process. It’s there already… Assuming you haven’t created any networks yet, executing docker network ls should list the default Docker networks:

Continue reading

How to sell Golang to your employer

Can you translate that to human language? A little over a week ago, Loïc Hoguin, the creator of Cowboy - a very popular web server built in Erlang, published an article about his experience of conviencing people to use Erlang, or rather their reaction when they see the Erlang’s syntax :) It inspired me to write this post. It’s hard to change humans habits (that’s how our brain works), so even if you give someone a super tool solving their problems but it will require changing their habits it might take longer than you expect.

Continue reading

Running Go on Android

Running indirectly… The Go Mobile project is marked as “experimental” and I guess it will take a couple of years until we’ll get some stable version. The way I’m going to show you how to run Go programs on Android is a bit tricky as it actually uses Termux which is an Android terminal emulator and Linux environment app. Technically we could install and run there many other languages, but let’s see how it’s getting on with Go.

Continue reading