Skip to content

Commit 4b74de0

Browse files
web3-botmvdan
authored andcommitted
update .github/workflows/go-check.yml
1 parent c63c0ce commit 4b74de0

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

.github/workflows/go-check.yml

+41-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,50 @@
1-
# Workflow managed by ipldbot. DO NOT EDIT.
2-
# See https://github.com/ipld/.github/ for details.
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
33

44
on: [push, pull_request]
5+
name: Go Checks
56

67
jobs:
78
unit:
89
runs-on: ubuntu-latest
9-
name: Go checks
10+
name: All
1011
steps:
1112
- uses: actions/checkout@v2
12-
- name: golangci-lint
13-
uses: golangci/golangci-lint-action@d9f0e73c0497685d68af8c58280f49fcaf0545ff # v2.5.1
1413
with:
15-
version: v1.33
16-
args: "--disable-all --enable gofmt,govet"
14+
submodules: recursive
15+
- uses: actions/setup-go@v2
16+
with:
17+
go-version: "1.16.x"
18+
- name: Install staticcheck
19+
run: go install honnef.co/go/tools/cmd/staticcheck@434f5f3816b358fe468fa83dcba62d794e7fe04b # 2021.1 (v0.2.0)
20+
- name: Check that go.mod is tidy
21+
uses: protocol/[email protected]
22+
with:
23+
run: |
24+
go mod tidy
25+
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
26+
echo "go.sum was added by go mod tidy"
27+
exit 1
28+
fi
29+
git diff --exit-code -- go.sum go.mod
30+
- name: gofmt
31+
if: ${{ success() || failure() }} # run this step even if the previous one failed
32+
run: |
33+
out=$(gofmt -s -l .)
34+
if [[ -n "$out" ]]; then
35+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
36+
exit 1
37+
fi
38+
- name: go vet
39+
if: ${{ success() || failure() }} # run this step even if the previous one failed
40+
uses: protocol/[email protected]
41+
with:
42+
run: go vet ./...
43+
- name: staticcheck
44+
if: ${{ success() || failure() }} # run this step even if the previous one failed
45+
uses: protocol/[email protected]
46+
with:
47+
run: |
48+
set -o pipefail
49+
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
50+

0 commit comments

Comments
 (0)