You've already forked testing-go-code-with-postgres
mirror of
https://github.com/xorcare/testing-go-code-with-postgres.git
synced 2025-06-30 23:23:40 +02:00
Add lint to CI
It is necessary to remember not to bring the code to a state complying with the rules.
This commit is contained in:
14
.github/workflows/go.yml
vendored
14
.github/workflows/go.yml
vendored
@ -33,3 +33,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Teardown test environment
|
- name: Teardown test environment
|
||||||
run: make test-env-up
|
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
|
||||||
|
14
.golangci.yml
Normal file
14
.golangci.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- errcheck
|
||||||
|
- godot
|
||||||
|
- goimports
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- misspell
|
||||||
|
- staticcheck
|
||||||
|
- typecheck
|
||||||
|
- unused
|
||||||
|
- whitespace
|
16
Makefile
16
Makefile
@ -28,21 +28,7 @@ test-env-down: ## Down and cleanup test environment.
|
|||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: tools ## Check the project with lint.
|
lint: tools ## Check the project with lint.
|
||||||
@golangci-lint run \
|
@golangci-lint run --fix ./...
|
||||||
--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 \
|
|
||||||
./...
|
|
||||||
|
|
||||||
tools: ## Install all needed tools, e.g.
|
tools: ## Install all needed tools, e.g.
|
||||||
@go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
|
@go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
|
||||||
|
Reference in New Issue
Block a user