-
When I started learning golang almost 9 years ago I've learned myself to structure it like a Laravel framework. The main api is also build in that fashion and to big to split it up or rebuild it.. Which bit me in the ass quite a few times. I recently switched job and am unlearning the MVC setup and trying to build it more like described here : https://github.com/golang-standards/project-layout
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
So what can you do insted? For testing databases, setup a docker instance for tests (e.g. like in https://github.com/ardanlabs/service), or start an embedded-postgres daemon (see https://github.com/fergusstrange/embedded-postgres). For communication with external APIs, just pass the http.Client (either in context.Context or as a field on the struct). Then in tests, you can override the http.Client.Transport func.
-
embedded-postgres
Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test
So what can you do insted? For testing databases, setup a docker instance for tests (e.g. like in https://github.com/ardanlabs/service), or start an embedded-postgres daemon (see https://github.com/fergusstrange/embedded-postgres). For communication with external APIs, just pass the http.Client (either in context.Context or as a field on the struct). Then in tests, you can override the http.Client.Transport func.
-
go-training
Go Training Repositories regroups some useful resources to learn Go Programming Language