-
Notifications
You must be signed in to change notification settings - Fork 492
52 lines (43 loc) · 1.33 KB
/
go.yml
File metadata and controls
52 lines (43 loc) · 1.33 KB
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
name: Go
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
pull-requests: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build
run: go build ./...
- name: Test
run: go test -race ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
- name: Check for go fix suggestions
run: |
# When this repo moves to a Go version that supports `go fix -diff`,
# this can be simplified back to checking the diff output directly.
go fix ./...
if ! git diff --exit-code -- .; then
echo "::error::go fix found modernization opportunities"
echo "Run 'go fix ./...' locally and commit the changes."
exit 1
fi
gofmt -w -r 'interface{} -> any' .
if ! git diff --exit-code -- .; then
echo "::error::gofmt found modernization opportunities"
echo "Run 'gofmt -w -r 'interface{} -> any' .' locally and commit the changes."
exit 1
fi
echo "✓ No go fix suggestions - code is up to date."