File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: Build
22
33on :
44 push :
5- branches : [main]
5+ branches : [main,staging ]
66 pull_request :
77 branches : [main]
88
1919 with :
2020 go-version : ' 1.22'
2121
22+ - name : Format check
23+ run : |
24+ # Check formatting excluding vendor directory
25+ UNFORMATTED=$(gofmt -l $(find . -name '*.go' -not -path './vendor/*'))
26+ if [ -n "$UNFORMATTED" ]; then
27+ echo "Go code is not formatted:"
28+ gofmt -d $(find . -name '*.go' -not -path './vendor/*')
29+ exit 1
30+ fi
31+
32+ - name : Vet
33+ run : make vet
34+
2235 - name : Build
2336 run : make build
2437
Original file line number Diff line number Diff line change 1- .PHONY : build build-all clean test install
1+ .PHONY : build build-all clean test install fmt vet
22
33VERSION := $(shell git update-index --refresh >/dev/null 2>&1; git describe --tags --always --dirty 2>/dev/null || echo dev)
44LDFLAGS := -ldflags "-X github.com/egeskov/odooctl/cmd.version=$(VERSION ) "
@@ -23,6 +23,14 @@ clean:
2323test :
2424 go test -v ./...
2525
26+ # Format code (excluding vendor)
27+ fmt :
28+ @find . -name ' *.go' -not -path ' ./vendor/*' -exec gofmt -w {} \;
29+
30+ # Run go vet (excluding vendor)
31+ vet :
32+ @go vet $(shell go list ./... | grep -v /vendor/)
33+
2634# Install to GOPATH/bin
2735install :
2836 go install $(LDFLAGS ) .
You can’t perform that action at this time.
0 commit comments