Skip to content

Commit 8e7bcc9

Browse files
authored
Merge pull request #3 from mart337i/staging
[ADD] Add better docs and minor optimizations
2 parents c6bebfc + 0259eb3 commit 8e7bcc9

7 files changed

Lines changed: 602 additions & 398 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main,staging]
66
pull_request:
77
branches: [main]
88

@@ -19,6 +19,19 @@ jobs:
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

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build build-all clean test install
1+
.PHONY: build build-all clean test install fmt vet
22

33
VERSION := $(shell git update-index --refresh >/dev/null 2>&1; git describe --tags --always --dirty 2>/dev/null || echo dev)
44
LDFLAGS := -ldflags "-X github.com/egeskov/odooctl/cmd.version=$(VERSION)"
@@ -23,6 +23,14 @@ clean:
2323
test:
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
2735
install:
2836
go install $(LDFLAGS) .

0 commit comments

Comments
 (0)