Skip to content

Commit 78f113e

Browse files
authored
Use golangci-lint action and update linters (#34)
1 parent ac67794 commit 78f113e

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

.github/workflows/cicd.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,23 @@ on:
1616

1717
jobs:
1818
checks:
19-
name: Formatting and Linting
20-
runs-on: ubuntu-20.04
19+
name: Linting
20+
runs-on: ubuntu-22.04
2121
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v3
2224
- name: Setup Golang Environment
2325
uses: actions/setup-go@v3
2426
with:
25-
go-version: '1.15'
26-
- name: Checkout code
27-
uses: actions/checkout@v3
28-
- name: Lint code
29-
run: |
30-
make init
31-
make fmt
32-
make lint
27+
go-version-file: go.mod
28+
- name: Lint Code
29+
uses: golangci/golangci-lint-action@v3
30+
with:
31+
only-new-issues: true
3332

3433
unit-tests:
3534
name: Unit Tests
36-
runs-on: ubuntu-20.04
35+
runs-on: ubuntu-22.04
3736
needs: checks
3837
steps:
3938
- name: Checkout Repository

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
release:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
1111
steps:
1212
- uses: actions/checkout@v2
1313

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ linters:
2525
- golint
2626
- maligned
2727
- scopelint
28+
# deprecated
29+
- deadcode
30+
- varcheck
31+
- structcheck
32+
- nosnakecase
2833

2934

3035
# Run options

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,30 @@ deps-upgrade:
3434
#######################################
3535
## Tests, codegen, lint and format.
3636
#######################################
37-
fmt: $(info Running goimports...)
37+
fmt:
38+
$(info Running goimports...)
3839
@goimports -w -e $$(find . -type f -name '*.go' -not -path "./vendor/*")
3940

40-
test: $(info Running unit tests...)
41+
test:
42+
$(info Running unit tests...)
4143
mkdir -p $(RESULTS_DIR)
4244
CGO_ENABLED=1 go test -race -v -cover ./... -coverprofile=$(RESULTS_DIR)/$(PACKAGE)-coverage.out 2>&1 | tee >(go-junit-report > $(RESULTS_DIR)/report.xml)
4345
@echo "Total code coverage:"
4446
@go tool cover -func=$(RESULTS_DIR)/$(PACKAGE)-coverage.out | grep 'total:' | tee $(RESULTS_DIR)/anybadge.out
4547
@go tool cover -html=$(RESULTS_DIR)/$(PACKAGE)-coverage.out -o $(RESULTS_DIR)/coverage.html
4648

47-
test-only-failed: $(info Running unit tests (showing only failed ones with context)...)
49+
test-only-failed:
50+
$(info Running unit tests (showing only failed ones with context)...)
4851
go test -v -race ./... | grep --color -B 45 -A 5 -E '^FAIL.+'
4952

5053
$(LINT_BIN):
51-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.36.0
54+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2
5255

5356
lint: $(LINT_BIN)
5457
$(LINT_BIN) run
5558

5659
lint-docker:
57-
docker run --rm -v "${PWD}":/app -w /app golangci/golangci-lint:v1.36.0 golangci-lint run
60+
docker run --rm -v "${PWD}":/app -w /app golangci/golangci-lint:v1.51.2 golangci-lint run
5861

5962
lint-shell:
6063
shellcheck -x $$(find . -name "*.sh" -type f -not -path "./vendor/*")

0 commit comments

Comments
 (0)