diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..b8a2111 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,9 @@ +version: "2" + +run: + timeout: 3m + modules-download-mode: readonly + +linters: + enable: + - revive diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d85ba7a..e1cd748 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -60,6 +60,7 @@ Spaeter zusaetzlich sinnvoll: - `docker` und `docker compose` - `postgresql-client` - `mosquitto-clients` +- `golangci-lint` Fuer Container-Builds liegen erste Dockerfiles in: @@ -114,6 +115,7 @@ Aktuell bedeutet das: - `make run-backend` startet das Backend - `make run-agent` startet den Agenten - `make fmt` formatiert beide Go-Module +- `make lint` prueft beide Go-Module mit `golangci-lint` Hinweis: diff --git a/Makefile b/Makefile index d096e91..402f284 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BACKEND_DIR=server/backend AGENT_DIR=player/agent -.PHONY: build build-backend build-agent run-backend run-agent fmt +.PHONY: build build-backend build-agent run-backend run-agent fmt lint lint-backend lint-agent build: build-backend build-agent @@ -20,3 +20,11 @@ run-agent: fmt: cd $(BACKEND_DIR) && go fmt ./... cd $(AGENT_DIR) && go fmt ./... + +lint: lint-backend lint-agent + +lint-backend: + cd $(BACKEND_DIR) && golangci-lint run --config ../../.golangci.yml ./... + +lint-agent: + cd $(AGENT_DIR) && golangci-lint run --config ../../.golangci.yml ./...