diff --git a/Makefile b/Makefile index 92ccb307b7716dc2dc62d915b8cbd351d414f419..c5507abd4661d656d0246eef7759947c9436aab9 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ $(BIN_DIR)/artifact.bin: .PHONY: build-linux build-linux: export GOOS := linux build-linux: export GOARCH := amd64 +build-linux: export CGO_ENABLED := 0 build-linux: $(BIN_DIR)/artifact.bin diff --git a/README.md b/README.md index 9ef0351bcae2bf3682d661893472d282f91e6a86..adb301f230a9136e279c40f2f94c15f71e7b28d5 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ Webservice ========== -A Go-based simple web service meant to be the subject for any tutorial -or maybe even the project work. +A Go-based simple web service meant to be the subject of any tutorial +or even used the project work. -__Prerequisites:__ +#### Prerequisites: * Go toolchain (install via system package manager or [by hand](https://go.dev/doc/install)) -__Primary interactions:__ +#### Build 1. Install dependencies: `go get -t ./...` 2. Run locally: `go run .` 3. Execute unit tests: `go test -race -v ./...` 4. Build artifact: `go build -o ./artifact.bin ./*.go` -To build for another platform, set `GOOS` and `GOARCH`. For more details, -please refer to the `Makefile`. +To build for another platform, set `GOOS` and `GOARCH`. To yield a static binary (fully +self-contained, no dynamic linking) set `CGO_ENABLED=0`. For more details, please refer +to the [Makefile](./Makefile).