Skip to content

Commit cd60143

Browse files
authored
Adds golangci-lint job (#8)
Uses golangci/golangci-lint-action for linting the golang code, and adds a few additional linters. Also builds the go binary to ensure there are no compilation errors.
1 parent 1692853 commit cd60143

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
golangci:
14+
name: lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: stable
21+
- name: golangci-lint
22+
uses: golangci/golangci-lint-action@v6
23+
with:
24+
version: v1.60
25+
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-go@v5
31+
with:
32+
go-version: stable
33+
- name: Build
34+
run: go build -v -buildvcs=false -o bin/mutating-pebble-webhook ./cmd/

.golangci.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
output:
2+
print-linter-name: true
3+
4+
linters:
5+
# Some linters are already enabled by default, no need to explicitly add them here.
6+
# https://golangci-lint.run/usage/linters#enabled-by-default
7+
enable:
8+
# bugs / errors
9+
- dupl
10+
- gosec
11+
- revive
12+
13+
# performance
14+
- gocritic
15+
- prealloc
16+
17+
# style, formatting
18+
- goconst
19+
- gofmt
20+
- stylecheck
21+
- tagliatelle
22+
23+
linters-settings:
24+
errcheck:
25+
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
26+
# Such cases aren't reported by default.
27+
# Default: false
28+
check-type-assertions: true

0 commit comments

Comments
 (0)