88 unit :
99 runs-on : ubuntu-latest
1010 name : All
11- env :
12- RUNGOGENERATE : false
1311 steps :
1412 - uses : actions/checkout@v3
1513 with :
1614 submodules : recursive
15+ - id : config
16+ uses : protocol/.github/.github/actions/read-config@master
1717 - uses : actions/setup-go@v3
1818 with :
19- go-version : " 1.19.x "
19+ go-version : 1.20.x
2020 - name : Run repo-specific setup
2121 uses : ./.github/actions/go-check-setup
2222 if : hashFiles('./.github/actions/go-check-setup') != ''
23- - name : Read config
24- if : hashFiles('./.github/workflows/go-check-config.json') != ''
25- run : |
26- if jq -re .gogenerate ./.github/workflows/go-check-config.json; then
27- echo "RUNGOGENERATE=true" >> $GITHUB_ENV
28- fi
2923 - name : Install staticcheck
30- run : go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3 )
24+ run : go install honnef.co/go/tools/cmd/staticcheck@4970552d932f48b71485287748246cf3237cebdf # 2023.1 (v0.4.0 )
3125 - name : Check that go.mod is tidy
32263327 with :
@@ -39,32 +33,32 @@ jobs:
3933 fi
4034 git diff --exit-code -- go.sum go.mod
4135 - name : gofmt
42- if : ${{ success() || failure() }} # run this step even if the previous one failed
36+ if : success() || failure() # run this step even if the previous one failed
4337 run : |
4438 out=$(gofmt -s -l .)
4539 if [[ -n "$out" ]]; then
4640 echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
4741 exit 1
4842 fi
4943 - name : go vet
50- if : ${{ success() || failure() }} # run this step even if the previous one failed
44+ if : success() || failure() # run this step even if the previous one failed
51455246 with :
5347 run : go vet ./...
5448 - name : staticcheck
55- if : ${{ success() || failure() }} # run this step even if the previous one failed
49+ if : success() || failure() # run this step even if the previous one failed
56505751 with :
5852 run : |
5953 set -o pipefail
6054 staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
6155 - name : go generate
625663- if : (success() || failure()) && env.RUNGOGENERATE == ' true'
57+ if : (success() || failure()) && fromJSON(steps.config.outputs.json).gogenerate == true
6458 with :
6559 run : |
6660 git clean -fd # make sure there aren't untracked files / directories
67- go generate ./...
61+ go generate -x ./...
6862 # check if go generate modified or added any files
6963 if ! $(git add . && git diff-index HEAD --exit-code --quiet); then
7064 echo "go generated caused changes to the repository:"
0 commit comments