Writing Go applications in an isolated environment with Docker comes with some great advantages. You get the bare essentials for developing, and you can easily change which Go version you’re developing against.
In this tutorial, we’re going to show you how to structure a Go application with Docker Compose as your development environment.
In the end you'll have:
- A docker compose setup to develop in
- An HTTP server written in Go that is connected to Postgres
- An auto-reloading server that compiles when you change a file
Source: Develop a Go app with Docker Compose, an article by Robert Ross.