Add checks for gofmt

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2023-01-20 23:17:59 +02:00
parent 38b2ef5966
commit 4063265478
No known key found for this signature in database
GPG key ID: 7D073DCC2C074CB5
2 changed files with 9 additions and 4 deletions

View file

@ -18,19 +18,20 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libbtrfs-dev
sudo apt-get install -y libbtrfs-dev build-essential
- uses: actions/setup-go@v3
with:
go-version: 'stable'
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
with:
version: v1.49.0
skip-cache: true
args: --timeout=8m --build-tags testing
- name: Verify go vendor and go modules
- name: Verify go vendor, go modules and gofmt
run: |
sudo apt-get install -y jq
make verify-vendor
make verify
go-tests:
runs-on: ubuntu-latest

View file

@ -21,6 +21,9 @@ build-static:
test:
go test -race -mod=vendor -tags testing -v $(TEST_ARGS) -timeout=15m -parallel=4 -count=1 ./...
fmtcheck:
@gofmt -l -s $$(go list ./... | sed 's|garm/||g') | grep ".*\.go"; if [ "$$?" -eq 0 ]; then echo "gofmt check failed; please tun gofmt -w -s"; exit 1;fi
verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
$(eval TMPDIR := $(shell mktemp -d))
@cp -R ${ROOTDIR} ${TMPDIR}
@ -28,3 +31,4 @@ verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
@diff -r -u -q ${ROOTDIR} ${TMPDIR}/garm
@rm -rf ${TMPDIR}
verify: verify-vendor fmtcheck