Skip to content

Commit 89c9a54

Browse files
committed
Update golangci to 1.49
Signed-off-by: Derek McGowan <[email protected]>
1 parent cf26711 commit 89c9a54

2 files changed

Lines changed: 76 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,68 @@ on:
66
pull_request:
77
branches: [ main ]
88

9-
jobs:
10-
11-
checks:
12-
name: Project Checks
13-
runs-on: ubuntu-22.04
14-
timeout-minutes: 5
15-
16-
steps:
17-
- uses: actions/setup-go@v2
18-
with:
19-
go-version: 1.20.x
20-
21-
- name: Set env
22-
shell: bash
23-
run: |
24-
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
25-
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
9+
env:
10+
# Go version we currently use to build containerd across all CI.
11+
# Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions.
12+
GO_VERSION: "1.21.0"
2613

27-
- uses: actions/checkout@v2
28-
with:
29-
path: src/github.com/containerd/log
30-
fetch-depth: 25
14+
permissions: # added using https://github.com/step-security/secure-workflows
15+
contents: read
3116

32-
- uses: containerd/project-checks@v1
33-
with:
34-
working-directory: src/github.com/containerd/log
17+
jobs:
3518

19+
#
20+
# golangci-lint
21+
#
3622
linters:
23+
permissions:
24+
contents: read # for actions/checkout to fetch code
25+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
3726
name: Linters
3827
runs-on: ${{ matrix.os }}
3928
timeout-minutes: 10
4029

4130
strategy:
4231
matrix:
43-
go-version: [1.20.x]
44-
os: [ubuntu-22.04]
32+
os: [ubuntu-22.04, macos-12] # TODO: Add windows-2019
4533

4634
steps:
47-
- uses: actions/checkout@v2
35+
- uses: actions/setup-go@v4
4836
with:
49-
path: src/github.com/containerd/log
37+
go-version: ${{ env.GO_VERSION }}
38+
cache: false # see actions/setup-go#368
5039

51-
- name: Set env
52-
shell: bash
53-
run: |
54-
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
55-
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
40+
- uses: actions/checkout@v3
41+
- uses: golangci/golangci-lint-action@v3
42+
with:
43+
version: v1.52.2
44+
skip-cache: true
45+
args: --timeout=5m
46+
47+
#
48+
# Project checks
49+
#
50+
project:
51+
name: Project Checks
52+
if: github.repository == 'containerd/log'
53+
runs-on: ubuntu-22.04
54+
timeout-minutes: 5
55+
56+
steps:
57+
- uses: actions/setup-go@v4
58+
with:
59+
go-version: ${{ env.GO_VERSION }}
60+
cache: false # see actions/setup-go#368
61+
62+
- uses: actions/checkout@v3
63+
with:
64+
path: src/github.com/containerd/log
65+
fetch-depth: 25
5666

57-
- uses: golangci/golangci-lint-action@v2
67+
- uses: containerd/[email protected]
5868
with:
59-
version: v1.29
6069
working-directory: src/github.com/containerd/log
70+
repo-access-token: ${{ secrets.GITHUB_TOKEN }}
6171

6272
tests:
6373
name: Tests
@@ -71,7 +81,7 @@ jobs:
7181

7282
- uses: actions/setup-go@v2
7383
with:
74-
go-version: 1.20.x
84+
go-version: ${{ env.GO_VERSION }}
7585

7686
- name: Set env
7787
shell: bash

.golangci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
linters:
2+
enable:
3+
- exportloopref # Checks for pointers to enclosing loop variables
4+
- gofmt
5+
- goimports
6+
- gosec
7+
- ineffassign
8+
- misspell
9+
- nolintlint
10+
- revive
11+
- staticcheck
12+
- tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17
13+
- unconvert
14+
- unused
15+
- vet
16+
- dupword # Checks for duplicate words in the source code
17+
disable:
18+
- errcheck
19+
20+
run:
21+
timeout: 5m
22+
skip-dirs:
23+
- api
24+
- cluster
25+
- design
26+
- docs
27+
- docs/man
28+
- releases
29+
- reports
30+
- test # e2e scripts

0 commit comments

Comments
 (0)