11name : Go 
22on :
33  push :
4-     branches : [master] 
4+     branches : [ master ] 
5+     paths :
6+       - ' **.go' 
7+       - ' go.mod' 
8+       - ' .golangci.yml' 
9+       - ' .github/workflows/go.yml' 
510  pull_request :
11+     paths :
12+       - ' **.go' 
13+       - ' go.mod' 
14+       - ' .golangci.yml' 
15+       - ' .github/workflows/go.yml' 
616env :
717  GOPROXY : " https://proxy.golang.org" 
818
@@ -18,32 +28,34 @@ jobs:
1828        with :
1929          version : latest 
2030          args : --timeout=30m 
31+       - name : Check Go module tidiness 
32+         shell : bash 
33+         run : | 
34+           go mod tidy 
35+           STATUS=$(git status --porcelain go.mod go.sum) 
36+           if [ ! -z "$STATUS" ]; then 
37+             echo "Running go mod tidy modified go.mod and/or go.sum" 
38+             exit 1 
39+           fi 
2140
2241test :
2342    name : Test 
2443    strategy :
2544      matrix :
26-         go-version : [1.14 .x, 1.15 .x, 1.16.x ] 
27-         platform : [ubuntu-latest, macos-latest, windows-latest] 
45+         go-version : [ 1.16 .x, 1.17 .x, 1.18.x  ] 
46+         platform : [  ubuntu-latest, macos-latest, windows-latest  ] 
2847    runs-on : ${{ matrix.platform }} 
2948    steps :
3049      - name : Install Go 
31-         uses : actions/setup-go@v1  
50+         uses : actions/setup-go@v2  
3251        with :
3352          go-version : ${{ matrix.go-version }} 
3453      - name : Checkout code 
3554        uses : actions/checkout@v2 
36-       - name : Run unit  tests 
55+       - name : Run tests with coverage  
3756        run : go test -v -race -coverprofile=coverage -covermode=atomic ./... 
3857      - name : Upload coverage report to Codecov 
39-         uses : codecov/codecov-action@v1.0.6  
58+         uses : codecov/codecov-action@v1.5.0  
4059        with :
4160          file : ./coverage 
4261          flags : unittests 
43-       - name : Cache downloaded modules 
44-         uses : actions/cache@v1 
45-         with :
46-           path : ~/go/pkg/mod 
47-           key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 
48-           restore-keys : | 
49-             ${{ runner.os }}-go- 
0 commit comments