-
Notifications
You must be signed in to change notification settings - Fork 10
55 lines (45 loc) · 1.29 KB
/
lint-golang.yml
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
49
50
51
52
53
54
name: Lint golang
on:
push:
branches:
- 'main'
paths:
- 'src/go/**'
tags-ignore:
- '**'
pull_request:
paths:
- 'src/go/**'
env:
GOPRIVATE: github.com/redpanda-data/*
jobs:
go:
name: Lint go files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Install gofumpt
env:
GOFUMPT_VER: 0.5.0
run: |
mkdir -v -p "$HOME/.local/bin"
wget -O "$HOME/.local/bin/gofumpt" "https://github.com/mvdan/gofumpt/releases/download/v${GOFUMPT_VER}/gofumpt_v${GOFUMPT_VER}_linux_amd64"
chmod 0700 "$HOME/.local/bin/gofumpt"
- name: Run gofumpt
run: |
find src/go -type f -not -name 'zz*' -name '*.go' | xargs -n1 "$HOME/.local/bin/gofumpt" -w -lang=1.21
git diff --exit-code
- name: configure git
env:
GH_ACCESS_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN }}
run: git config --global "url.https://[email protected]/.insteadOf" https://github.com/
- name: go mod tidy (k8s)
working-directory: src/go/k8s
run: |
GOPRIVATE=github.com/redpanda-data/* go mod tidy
git diff --exit-code -- go.mod go.sum