From 8215b2f2bc23903fada1a89ab94fb5a1e9677f34 Mon Sep 17 00:00:00 2001 From: Kanstantsin Buklis Date: Tue, 3 Feb 2026 16:41:18 +0100 Subject: [PATCH] chore(fmt): add gofumpt to CI --- .github/workflows/golangci-lint.yaml | 38 ++++++++++++++++++++++++++++ Makefile | 8 +++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/golangci-lint.yaml diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml new file mode 100644 index 000000000..72f10f87a --- /dev/null +++ b/.github/workflows/golangci-lint.yaml @@ -0,0 +1,38 @@ +name: golangci-lint + +on: + pull_request: + +permissions: + contents: read + +jobs: + golangci-lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: 'go.mod' + + - name: Install Ginkgo + run: go install github.com/onsi/ginkgo/v2/ginkgo + + - name: Install Mockery + run: go install github.com/vektra/mockery/v2@v2.53.5 + + - name: Install golangci-lint + run: make install-golangci-lint + + - name: Generate Mockery code + run: make mockery + + - name: Generate Gqlgen code + run: make gqlgen + + - name: Run golangci-lint + run: make lint diff --git a/Makefile b/Makefile index e0b848d81..57442c1cf 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ ARCH := $(shell go env GOARCH) SHELL=/bin/bash MIGRATIONS_DIR=internal/database/mariadb/migrations/ -.PHONY: all test doc gqlgen mockery test-all test-e2e test-app test-db fmt compose-prepare compose-up compose-down compose-restart compose-build check-call-cached check-migration-files +.PHONY: all test doc gqlgen mockery test-all test-e2e test-app test-db fmt lint compose-prepare compose-up compose-down compose-restart compose-build check-call-cached check-migration-files # Source the .env file to use the env vars with make -include .env @@ -102,6 +102,12 @@ install-gofumpt: fmt: gofumpt -l -w . +install-golangci-lint: + go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0 + +lint: + golangci-lint run + DOCKER_COMPOSE := docker-compose -f docker-compose.yaml DOCKER_COMPOSE_SERVICES := heureka-app heureka-db valkey compose-prepare: