If your CGO development toolchain depends on external dependencies such as system libraries, or you want to develop on an older version of go while having a different version on your host, you can use a docker container and mount the source from your host machine and build the project inside the container. This can enable us to have a consistent development environment across various developers and their host systems without having to modify system libraries.
Go recently introduced a heavily requested feature that allows programmers to set socket options before accepting and creating connections. You can find a mention of this in Go 1.11 Release Notes. Although, not many have written on this and implementing this is a bit confusing due to a change in the way one has to implement this. So I decided to share this with others who might be interested in using this feature.
Suppose you have a HTTP request to be sent but don’t care about the result or errors. This request is sent through a function which is usually called inside a goroutine and is not in any way a core aspect of your main logic. The only important part is forming the actual request and the payload. When you wrote this function, you did not write tests as it would be a pain to make the function return something and check it.