1
0
mirror of https://github.com/xorcare/testing-go-code-with-postgres.git synced 2025-06-30 23:23:40 +02:00

Add check actuality of go.mod and go.sum

This commit is contained in:
Vasiliy Vasilyuk
2024-02-08 22:37:22 +03:00
parent c0e268facd
commit 5514fbebff
2 changed files with 45 additions and 0 deletions

View File

@ -38,6 +38,32 @@ jobs:
env: env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Check actuality of go.mod and go.sum
#
# See https://xorcare.ru/s/8dd13
check-go-modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.0'
- name: Check actuality of go.mod and go.sum
run: |
go mod tidy
git diff --exit-code && exit 0 || true
echo '######################################################################'
echo
echo "ERROR: go.mod or go.sum is different from the committed version"
echo "Try using 'go mod tidy' to fix the go.mod and go.sum files"
echo "Also, don't forget to commit and push changes"
echo
echo '######################################################################'
exit 1
golangci: golangci:
name: lint name: lint
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -47,3 +47,22 @@ test:
coverage: '/^total:\s+\(statements\)\s+(\d+(?:\.\d+)?%)/' coverage: '/^total:\s+\(statements\)\s+(\d+(?:\.\d+)?%)/'
only: only:
- branches - branches
# Check actuality of go.mod and go.sum
#
# See https://xorcare.ru/s/8dd13
check-go-modules:
stage: test
script:
- go mod tidy
- |
git diff --exit-code && exit 0 || true
echo -e "\033[0;31m"
echo '######################################################################'
echo
echo "ERROR: go.mod or go.sum is different from the committed version"
echo "Try using 'go mod tidy' to fix the go.mod and go.sum files"
echo "Also, don't forget to commit and push changes"
echo
echo '######################################################################'
exit 1