How to mock exec.Command in Go

In some of my projects we have code that needs to run external executables, and it’s very difficult to test them, especially when your function is based on some kind of stdout parcing.

playgo - CLI tool to send .go file to the Go Playground

Usually when we share a runnable Go code we do: copy code, open Go Playground, paste code, click Share.

Go 1.8 released. What is new?

Go team has released new version on February 16. You can get it from the download page.

Add a Watermark to the image with image go package

Go is very rich for packages support. But I also can say that Go is a perfect language to write almost everything with help of stdlib only.

Perfect func main()

It’s the only one function all Go commands must have. You may say that everyone’s main() function is different, depends on a project.

Swaggerize your APIs

Swagger UI is a great tool and a must have for any respectable API project.

Memory leaks with mux.Router in Go

Today we found that our web server written in Go has memory leaks and consume around 300M of memory, which is really a lot for our app.

Go templates. Helper to render a struct

The Go language comes with a powerful built-in template engine. In Go, we have the template package to help handle templates.

UUID without dependencies in Go

Today I realized that size of my vendor/ folder in Golang project is around 150M.

Concurrency. Data race

What does data race mean in Golang? Data race is a common mistake in concurrent systems.