build(go): Check if go.mod and go.sum are up to dated (#1377)

This commit is to add job to check if go.mod and go.sum are up to
date.

Also add go.sum into .gitattributes so that it will be considered
as generated file in PR review.

Signed-off-by: Tam Mach <sayboras@yahoo.com>
This commit is contained in:
Tam Mach 2020-09-21 07:48:49 +10:00 committed by GitHub
parent 5efb842164
commit d4ebf99e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
go.sum linguist-generated

View File

@ -8,6 +8,21 @@ on:
- master
pull_request:
jobs:
# Check if there any dirty change for go mod tidy
go-mod:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Checkout code
uses: actions/checkout@v2
- name: Check go mod
run: |
go mod tidy
git diff --exit-code
# We already run the current golangci-lint in tests, but here we test
# our GitHub action with the latest stable golangci-lint.
golangci-lint: