Skip to content

Commit 52e95e5

Browse files
authored
Merge pull request #189 from WheeskyJack/linter_github_workflow
add golangci linter in github workflow action
2 parents 1e0fedf + 71d0f98 commit 52e95e5

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
golangci:
14+
name: golangci-lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v4
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.22'
23+
cache: false
24+
- name: Run golangci-lint
25+
uses: golangci/golangci-lint-action@v6
26+
with:
27+
version: v1.59
28+
29+
# Optional: working directory, useful for monorepos
30+
# working-directory: somedir
31+
32+
# Optional: golangci-lint command line arguments.
33+
#
34+
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
35+
# The location of the configuration file can be changed by using `--config=`
36+
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
37+
args: --verbose

.golangci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
run:
2+
timeout: 5m
3+
exclude-dirs:
4+
- vendor
5+
- examples
6+
7+
linters:
8+
enable:
9+
- errcheck
10+
- gocyclo
11+
- gofmt
12+
- goimports
13+
- gosimple
14+
- govet
15+
- ineffassign
16+
- staticcheck
17+
- unused
18+
19+
linters-settings:
20+
gocyclo:
21+
min-complexity: 20

0 commit comments

Comments
 (0)