From cfe9add3d7c11e69a7839f4273d0c350afd9586e Mon Sep 17 00:00:00 2001 From: Vasiliy Vasilyuk Date: Mon, 10 Jul 2023 23:05:51 +0300 Subject: [PATCH] Add lint to CI It is necessary to remember not to bring the code to a state complying with the rules. --- .github/workflows/go.yml | 14 ++++++++++++++ .golangci.yml | 14 ++++++++++++++ Makefile | 16 +--------------- 3 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6cb6174..5b3a76a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -33,3 +33,17 @@ jobs: - name: Teardown test environment run: make test-env-up + + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.53 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..ddfef1b --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,14 @@ +linters: + disable-all: true + enable: + - errcheck + - godot + - goimports + - gosimple + - govet + - ineffassign + - misspell + - staticcheck + - typecheck + - unused + - whitespace diff --git a/Makefile b/Makefile index 54d5dc8..81797df 100644 --- a/Makefile +++ b/Makefile @@ -28,21 +28,7 @@ test-env-down: ## Down and cleanup test environment. .PHONY: lint lint: tools ## Check the project with lint. - @golangci-lint run \ - --fix \ - --disable-all \ - -E errcheck \ - -E godot \ - -E goimports \ - -E gosimple \ - -E govet \ - -E ineffassign \ - -E misspell \ - -E staticcheck \ - -E typecheck \ - -E unused \ - -E whitespace \ - ./... + @golangci-lint run --fix ./... tools: ## Install all needed tools, e.g. @go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2