blob: de15521292883958f1abcdf694b815c7cc4e7b94 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
name: Go
on:
push:
branches:
- master
pull_request: {}
jobs:
build-test:
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.18.x
- run: go build -gcflags="-m" ./...
- run: go test -v -race ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.18.x
- uses: dominikh/staticcheck-action@29e9b80fb8de0521ba4ed3fdf68fed5bbe82a2d2 # v1.1.0
with:
install-go: false
vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.18.x
- run: go vet ./...
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Run gofmt -d .
run: |
fmtvar="$(gofmt -d .)"
echo "$fmtvar"
test -z "$fmtvar"
modtidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Run go mod tidy
run: |
go mod tidy
gitdiff="$(git diff -U0)"
echo "$gitdiff"
test -z "$gitdiff"
vendor-diff:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ^1.18
- name: Checkout base commit
uses: actions/checkout@v3
with:
path: a
ref: ${{ github.base_ref }}
- name: Download dependencies of base commit
run: go mod vendor
working-directory: a
- name: Checkout PR
uses: actions/checkout@v3
with:
path: b
- name: Download dependencies of PR
run: go mod vendor
working-directory: b
- name: Diff of dependencies
run: diff -ur --color=always a/vendor b/vendor || true
|