Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -8,6 +10,8 @@ jobs:
runs-on: [self-hosted, pod]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: andstor/file-existence-action@v2
id: check_files
Expand All @@ -19,12 +23,17 @@ jobs:
docker run --rm -v /usr/local:/sys_usr_local registry.smtx.io/sdn-base/golang:1.20 cp -r /usr/local/go /sys_usr_local/
echo "PATH=${PATH}:/usr/local/go/bin" >> $GITHUB_ENV

- uses: golangci/golangci-lint-action@v3
if: steps.check_files.outputs.files_exists == 'true'
- name: setup golangci-lint from oci image
run: |
sudo docker run --rm -v /usr/local:/sys_usr_local registry.smtx.io/everoute/golangci-lint:1.62.2 cp -r /golangci-lint /sys_usr_local/bin/

- uses: everoute/golangci-lint-action@v5
with:
version: v1.52
skip-pkg-cache: true
skip-build-cache: true # skip cache because of flaky behaviors
install-mode: none
skip-cache: true
only-new-issues: true
env:
GOPROXY: http://goproxy.smartx.com|https://goproxy.cn|direct

generate-check:
runs-on: [self-hosted, pod]
Expand Down
14 changes: 8 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ linters-settings:
errcheck:
# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
ignore: fmt:.*,io/ioutil:^Read.*,io:Close
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*
- io:Close
lll:
line-length: 170
funlen:
Expand All @@ -12,7 +15,9 @@ linters-settings:
run:
timeout: 10m
issues-exit-code: 1
skip-files:

issues:
exclude-files:
- ".*_test.go$"
- ".*generate.*.go$"

Expand All @@ -21,12 +26,11 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- copyloopvar
- funlen
- goconst
- gocritic
Expand All @@ -45,10 +49,8 @@ linters:
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace
Loading