Skip to content
Snippets Groups Projects
Commit 612b5e98 authored by gjahn's avatar gjahn
Browse files

Add target to cross-compile for Linux (amd64)

Hint in readme on how to change built target platform.
parent 264d6a37
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ export PATH := $(BIN_DIR):$(PATH) ...@@ -14,7 +14,7 @@ export PATH := $(BIN_DIR):$(PATH)
export GOMODCACHE = $(LOCAL_DIR)/cache/go export GOMODCACHE = $(LOCAL_DIR)/cache/go
export GOTMPDIR = $(TMP_DIR)/go export GOTMPDIR = $(TMP_DIR)/go
export GOBIN = $(BIN_DIR)
default: clean install build run default: clean install build run
...@@ -39,6 +39,11 @@ $(BIN_DIR)/artifact.bin: ...@@ -39,6 +39,11 @@ $(BIN_DIR)/artifact.bin:
-o $(@) \ -o $(@) \
$(SRC_DIR)/*.go $(SRC_DIR)/*.go
.PHONY: build-linux
build-linux: export GOOS := linux
build-linux: export GOARCH := amd64
build-linux: $(BIN_DIR)/artifact.bin
.PHONY: test .PHONY: test
.SILENT: test .SILENT: test
......
...@@ -2,7 +2,7 @@ Webservice ...@@ -2,7 +2,7 @@ Webservice
========== ==========
A Go-based simple web service meant to be the subject for any tutorial A Go-based simple web service meant to be the subject for any tutorial
or even the project work. or maybe even the project work.
__Prerequisites:__ __Prerequisites:__
...@@ -10,11 +10,12 @@ __Prerequisites:__ ...@@ -10,11 +10,12 @@ __Prerequisites:__
* Go toolchain (install via system package manager or [by hand](https://go.dev/doc/install)) * Go toolchain (install via system package manager or [by hand](https://go.dev/doc/install))
__Main interactions:__ __Primary interactions:__
1. Install dependencies: `go get -t ./...` 1. Install dependencies: `go get -t ./...`
2. Run locally: `go run .` 2. Run locally: `go run .`
3. Execute unit tests: `go test -race -v ./...` 3. Execute unit tests: `go test -race -v ./...`
4. Build artifact: `go build -o ./artifact.bin ./*.go` 4. Build artifact: `go build -o ./artifact.bin ./*.go`
For more details, please refer to the `Makefile`. To build for another platform, set `GOOS` and `GOARCH`. For more details,
please refer to the `Makefile`.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment