Skip to content

Commit 8512be4

Browse files
divyansh42pratap0007
authored andcommitted
Fix golang CI lint failures
- Updated golangci-lint to use v2 version - Fixed regex to ignore the files like third_party in lint
1 parent b0cbc04 commit 8512be4

2 files changed

Lines changed: 104 additions & 6 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: ci
2+
3+
on: [pull_request] # yamllint disable-line rule:truthy
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }}
7+
cancel-in-progress: true
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
permissions:
14+
contents: read
15+
checks: write # Used to annotate code in the PR
16+
17+
jobs:
18+
build:
19+
name: build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
24+
with:
25+
go-version-file: "go.mod"
26+
- name: build
27+
run: |
28+
go build -v ./...
29+
linting:
30+
needs: [build]
31+
name: lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
36+
with:
37+
go-version-file: "go.mod"
38+
- name: gofmt
39+
run: |
40+
gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*'))
41+
if [[ -n "$gofmt_out" ]]; then
42+
failed=1
43+
fi
44+
echo "$gofmt_out"
45+
- name: golangci-lint
46+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
47+
with:
48+
version: v2.1.6
49+
only-new-issues: true
50+
args: --timeout=10m
51+
- name: yamllint
52+
run: |
53+
apt update && apt install -y yamllint
54+
yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print | tr '\n' ' ')
55+
- name: check-license
56+
run: |
57+
go install github.com/google/go-licenses@v1.0.0
58+
go-licenses check ./...
59+
tests:
60+
needs: [build]
61+
name: test
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
65+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
66+
with:
67+
go-version-file: "go.mod"
68+
- name: build
69+
run: |
70+
make test-unit-verbose-and-race
71+
generated:
72+
needs: [build]
73+
name: Check generated code
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
77+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
78+
with:
79+
go-version-file: "go.mod"
80+
- name: generated
81+
run: |
82+
go install github.com/google/go-licenses@v1.0.0 # Not sure why it is needed here
83+
./hack/verify-codegen.sh
84+
multi-arch-build:
85+
needs: [build]
86+
name: Multi-arch build
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
91+
with:
92+
go-version-file: "go.mod"
93+
- name: make cross
94+
run: |
95+
make cross
96+
e2e-tests:
97+
needs: [build]
98+
uses: ./.github/workflows/e2e-matrix.yml

.golangci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ linters:
3636
path: _test\.go
3737
paths:
3838
- vendor
39-
- third_party$
40-
- builtin$
41-
- examples$
39+
- third_party
40+
- builtin
41+
- examples
4242
formatters:
4343
enable:
4444
- gofmt
@@ -47,6 +47,6 @@ formatters:
4747
generated: lax
4848
paths:
4949
- vendor
50-
- third_party$
51-
- builtin$
52-
- examples$
50+
- third_party
51+
- builtin
52+
- examples

0 commit comments

Comments
 (0)