This is a Go micro-service written from scratch.
It shows how to use net/http, and how to structure a Go project.
It relies on Go 1.11 Beta 2 and the upcoming "Go modules" (formerly known as "vgo") support.
Dependency injection is used to insert a logger instance into the handler.
You can also notice how the test is constructed in order to provide testing for the handler.
A Docker container is available, thanks to the Dockerfile. It shows how to construct such containers.
Because this project uses go modules, as long as you are using Go 1.11 Beta 2+ or Go 1.10 with vgo support, you should be ok.
Clone this anywhere in your computer and create a project in your editor. I'm using GoLand IDE in order to work on the project during the presentation as well as have support for go modules.
The bundled, self-signed, certificates are bound to either dev.localhost:8080
or docker.localhost:8080
. I obviously
do not recommend using these in production.
I created this as part of the presentation at GopherCon UK 18.
The link for the video will be updated here when the presentation is out.
In order to learn how to approach package design in Go, you can read the following resources:
Once done, this article will help you understand the Design Philosophy On Packaging by William Kennedy.
This article describes how you can start approaching
I would like to thank you William "Bill" Kennedy for the inspiration he provided on getting me to do this talk.
This project is under the MIT license. Please see the LICENSE file for more details.