Custom Go HTTP handlers using generics

Few days ago Go 1.18beta1 was released and with it the first official generics support. I was embarrassed with standard Go’s HTTP handler functions for quite a while. If you are not familiar with Go, you probably wonder why, but if you are familiar, I believe you know. For example, implementing a RESTful API using idiomatic Go requires lot of code repetition in order to JSON decode request bodies and JSON encode response bodies....

2021-12-19 · 4 min · Boban Acimovic

Running stack of microservices using docker-compose and acim/go-reflex image

Go is very attractive language for microservices’ development, but using acim/go-reflex image and docker-compose you can run multiple microservices including your gateway on your local machine. This image can run virtually any Go server based application and also reacts on changes in the code and recompiles the binary on the fly. If you want to debug your microservices’ stack or develop a new feature where you have to touch multiple services, this is very good tool to do so....

2021-10-23 · 3 min · Boban Acimovic

VSCode setup for Go developers

According to lot of online polls, Visual Studio Code is the most popular IDE among Go developers. You can start Go development immediately after installing Go extension for VSCode, but some tuning may make your life easier. First of all, you may want to format the source code and reorganize imports automatically on each file save or code paste. In order to do so, put the following JSON snippet in your settings....

2021-03-16 · 2 min · Boban Acimovic

Upcoming Go's generics

In the very early adoption of Go by the open source community, lot of developers already suggested the lack of generics. However, some other claimed that simplicity of Go shouldn’t be compromised by generics. Few days ago, the never ending discussions pro and contra generics are finally over. The proposal is accepted and we can expect generics in Go 1.18 somewhere in spring of 2022. You may wonder why does it take that long, but this is not just about the compiler but also some parts of the standard library may need to be rewritten in order to replace the old code which could benefit from generics....

2021-02-26 · 5 min · Boban Acimovic

Go vanity imports

If you have just started learning Go or already developing in Go for quite some time, you may noticed that most of the Go packages are imported directly from their respective VCS repositories, but there are some packages imported from URL’s like golang.org/x/text or go.uber.org/zap . If you try to visit such URL’s, you may see different results like being redirected to documentation or just some dummy page. This is completely different from packages hosted on GitHub, for example github....

2021-02-21 · 2 min · Boban Acimovic