Instead of running `main` in a goroutine, the `net/http/httptest` package provides a better way to do API tests. Gin provides a nice example of this: https://github.com/gin-gonic/gin#testing.