build: fix makefile and CI 'fmt' and 'vet' tasks (#6937)
This commit is contained in:
parent
aad3bf98b0
commit
88d9d0fb09
|
@ -51,14 +51,17 @@ jobs:
|
|||
- run:
|
||||
name: check go fmt
|
||||
command: |
|
||||
files=$(go fmt ./...)
|
||||
files="$(go fmt ./... ; (cd api && go fmt ./... | sed 's@^@api/@') ; (cd sdk && go fmt ./... | sed 's@^@sdk/@'))"
|
||||
if [ -n "$files" ]; then
|
||||
echo "The following file(s) do not conform to go fmt:"
|
||||
echo "$files"
|
||||
exit 1
|
||||
fi
|
||||
- run:
|
||||
command: go vet ./...
|
||||
command: |
|
||||
go vet ./... && \
|
||||
(cd api && go vet ./...) && \
|
||||
(cd sdk && go vet ./...)
|
||||
environment:
|
||||
<<: *ENVIRONMENT
|
||||
|
||||
|
|
|
@ -307,11 +307,15 @@ cover:
|
|||
|
||||
format:
|
||||
@echo "--> Running go fmt"
|
||||
@go fmt $(GOFILES)
|
||||
@go fmt ./...
|
||||
@cd api && go fmt ./... | sed 's@^@api/@'
|
||||
@cd sdk && go fmt ./... | sed 's@^@sdk/@'
|
||||
|
||||
vet:
|
||||
@echo "--> Running go vet"
|
||||
@go vet -tags '$(GOTAGS)' $(GOFILES); if [ $$? -eq 1 ]; then \
|
||||
@go vet -tags '$(GOTAGS)' ./... && \
|
||||
(cd api && go vet -tags '$(GOTAGS)' ./...) && \
|
||||
(cd sdk && go vet -tags '$(GOTAGS)' ./...); if [ $$? -ne 0 ]; then \
|
||||
echo ""; \
|
||||
echo "Vet found suspicious constructs. Please check the reported constructs"; \
|
||||
echo "and fix them if necessary before submitting the code for review."; \
|
||||
|
|
Loading…
Reference in New Issue