1+ # all packages without any dependency to underlying tiny-go packages, e.g. "machine" or "device/arm"
2+ # also the complete image folder should be omitted
3+ BUILD_TAGS_CHECK := m5stack_core2,microbit,xiao_ble
4+ ALL_WITHOUT_MACHINE := $(shell go list -e -tags $(BUILD_TAGS_CHECK ) -f '{{.Dir}},{{.Deps}}' ./... | awk -F, '$$1 !~ /image/ && $$2 !~ /machine/ && $$2 !~ /device\/arm/ {print $$1}')
5+ ALL_TO_CHECK := $(ALL_WITHOUT_MACHINE )
6+
7+ .PHONY : clean fmt-check smoke-test unit-test test check fmt_check fmt_fix $(ALL_TO_CHECK )
18
29clean :
310 @rm -rf build
@@ -26,3 +33,33 @@ unit-test:
2633 @go test -v $(addprefix ./,$(TESTS ) )
2734
2835test : clean fmt-check unit-test smoke-test
36+
37+ fmt_quick_check :
38+ @# a very fast check before build, but depends on accessibility of all imports
39+ @# switch off the "stdmethods" analyzer is needed due to finding:
40+ @# at24cx/at24cx.go:57:18: method WriteByte(eepromAddress uint16, value uint8) error should have signature WriteByte(byte) error
41+ @# at24cx/at24cx.go:67:18: method ReadByte(eepromAddress uint16) (uint8, error) should have signature ReadByte() (byte, error)
42+ @# switch off the "shift" analyzer is needed due to finding:
43+ @# tmc5160/registers.go:1939:16: m.CUR_A (16 bits) too small for shift of 16
44+ @# tmc5160/registers.go:1996:16: m.X3 (8 bits) too small for shift of 27
45+ @# tmc5160/registers.go:1996:27: m.X2 (8 bits) too small for shift of 24
46+ @# tmc5160/registers.go:1996:38: m.X1 (8 bits) too small for shift of 21
47+ @# tmc5160/registers.go:1996:49: m.W3 (8 bits) too small for shift of 18
48+ @# tmc5160/registers.go:1996:60: m.W2 (8 bits) too small for shift of 16
49+ @# tmc5160/registers.go:1996:71: m.W1 (8 bits) too small for shift of 14
50+ @# tmc5160/registers.go:1996:82: m.W0 (8 bits) too small for shift of 12
51+ go vet -tags $(BUILD_TAGS_CHECK ) -stdmethods=false -shift=false $(ALL_TO_CHECK )
52+
53+ fmt_check :
54+ @# a complete format check, but depends on accessibility of all imports
55+ golangci-lint -v run $(ALL_TO_CHECK )
56+
57+ fmt_fix :
58+ @# an automatic reformat and complete format check, but depends on accessibility of all imports
59+ @# TODO: activate when ready
60+ @# gofumpt -l -w $(ALL_TO_CHECK)
61+ golangci-lint -v run $(ALL_TO_CHECK ) --fix
62+
63+ print_collected :
64+ @# this target is used to unify mechanism in CI with the local one, see ".github/workflows/golangci-lint.yml"
65+ @echo $(ALL_TO_CHECK )
0 commit comments