March 2020
Intermediate to advanced
406 pages
8h 39m
English
To garner some understanding of the build process, let's take a look at some build examples so we can gain some insight into how the build tooling works together.
Let's say we want to build a simple HTTP server that has a Prometheus exporter. We can create an exporter like so:
package mainimport ( "fmt" "net/http" "github.com/prometheus/client_golang/prometheus/promhttp")func main() { http.Handle("/", promhttp.Handler()) port := ":2112" fmt.Println("Prometheus Handler listening on port ", port) http.ListenAndServe(port, nil)}
After we have our package ready, we can build our package with the following:
go build -p 4 -race -x prometheusExporterExample.go
As we build this binary, we will see a couple of things coming back ...
Read now
Unlock full access