diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-01-20 12:00:32 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:44 +0100 |
| commit | 260e52050562281a90b970c44e8816afb5f4dbaf (patch) | |
| tree | fa760f4a2b4db32dda5ad8d4d40574b27e302dbd /go/Makefile | |
| parent | cbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5 (diff) | |
| download | muhqs-game-260e52050562281a90b970c44e8816afb5f4dbaf.tar.gz muhqs-game-260e52050562281a90b970c44e8816afb5f4dbaf.zip | |
intermediate commit
* Add static analysis and improve Makefile
* Implement hints from static code analysis
Diffstat (limited to 'go/Makefile')
| -rw-r--r-- | go/Makefile | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/go/Makefile b/go/Makefile index 6678a0fa..c38e3143 100644 --- a/go/Makefile +++ b/go/Makefile @@ -1,30 +1,42 @@ -PACKAGES := assets game server client webtools ui +PACKAGES := assets game server client ui APPS := server client OBJS := $(foreach app,$(APPS),$(app)/$(app)) WASM := client/client.wasm webtools/webtools.wasm -.PHONY: all fmt test $(OBJS) $(WASM) -all: $(OBJS) $(WASM) +GOFMT := go fmt -server/server: - @echo Building Server ... - pushd $(@D) >/dev/null && go build && popd >/dev/null +.PHONY: all fmt test check $(OBJS) $(WASM) +all: $(OBJS) $(WASM) -client/client: - @echo Building Client ... - pushd $(@D) >/dev/null && go build && popd >/dev/null +.PHONY: client server +client: client/client +server: server/server -client/client.wasm: - @echo Building Client.wasm ... - pushd $(@D) >/dev/null && env GOOS=js GOARCH=wasm go build -o $(@F) && popd >/dev/null +$(OBJS): + @echo Building $(@F) + @pushd $(@D) >/dev/null && go build && popd >/dev/null -webtools/webtools.wasm: - @echo Building Webtools.wasm ... - pushd $(@D) >/dev/null && env GOOS=js GOARCH=wasm go build -o $(@F) && popd >/dev/null +*/*.wasm: + @echo Building $(@F) ... + @pushd $(@D) >/dev/null && env GOOS=js GOARCH=wasm go build -o $(@F) && popd >/dev/null fmt: - set -e; for package in $(PACKAGES); do pushd $$package >/dev/null && go fmt && popd >/dev/null; done + @set -e; for package in $(PACKAGES) webtools; do \ + pushd $$package >/dev/null && $(GOFMT) && popd >/dev/null; \ + done test: - for package in $(PACKAGES); do pushd $$package >/dev/null && go test && popd >/dev/null; done + @STATUS=0; \ + for package in $(PACKAGES); do \ + if pushd "$$package" >/dev/null; then \ + go test; \ + status="$$?"; \ + if [ "$$status" -ne 0 ]; then STATUS="$$status"; fi; \ + popd >/dev/null; \ + fi; \ + done; \ + exit "$$STATUS" + +check: + golangci-lint run --skip-dirs webtools |
