How to Format Your Golang Code
Whether you agree with it or not, Go defines a code style at a language level (which I love), and not different styles per project - or having the style as an afterthought! This means there’s very little opinion or conflict when moving between projects so it’s easy. This is very important to Go, as it stresses clarity and consistency as some of the most important factors of code style.
Add Swagger Docs to a Go API
Swagger allows developers to easily create api documentation which is defined using comments in the code and then generated as a yaml config file. In this post we’ll be using it alongside Go (golang). Using tools like Swagger has many advantages, like allowing you to generate documentation automatically (saving you time) and that it keeps your code and documentation as close as possible (in distance terms). The idea being that if the docs are hard to update and far away, you just won’t.