-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (41 loc) · 1.16 KB
/
go_lint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Go linter for images
env:
GO_BUILD_TAGS: "CE EE"
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: Go linter for images
runs-on: [self-hosted, regular]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Run Go lint
run: |
basedir=$(pwd)
failed='false'
for i in $(find images -type f -name go.mod);do
dir=$(echo $i | sed 's/go.mod$//')
cd $basedir/$dir
# check all editions
for edition in $GO_BUILD_TAGS ;do
echo "Running linter in $dir (edition: $edition)"
golangci-lint run --build-tags $edition
if [ $? -ne 0 ]; then
echo "Linter failed in $dir (edition: $edition)"
failed='true'
fi
done
done
if [ $failed == 'true' ]; then
exit 1
fi