summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-08 05:11:38 -0500
committerJeff Carr <[email protected]>2025-10-08 05:11:38 -0500
commit5c345a875a1bcdb6fe3ffe5bf003cb0a1c0c4aba (patch)
treeef8af98f111a7813d811f5e7194049cd63e987f7
parent2d4ba7fdc16e37db63a80e4961289b8b129191ba (diff)
add "make generate"
-rw-r--r--Makefile10
-rw-r--r--generate.go14
2 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2bc55ef..10ecca7 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,16 @@ all: block.pb.go verbose
# -fixup --gui-check-plugin ../../../toolkits/gocui/gocui.so
fixup --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so
+default: generate install
+
+generate: clean
+ go mod init
+ go mod tidy
+ go generate
+
+go-generate:
+ rm -f *.pb.go *.patch
+
go-build: goimports
GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
diff --git a/generate.go b/generate.go
new file mode 100644
index 0000000..18830eb
--- /dev/null
+++ b/generate.go
@@ -0,0 +1,14 @@
+package main
+
+// NOTE: it would be helpful if go.mod doesn't exist, that go generate
+// would automatically run go mod init and go mod tidy
+// and allow directives to 'go get go.wit.com/apps/autogenpb'
+// then this process could be fully automated
+//
+//go:generate make go-generate
+//go:generate go get go.wit.com/apps/autogenpb
+//go:generate go install -v go.wit.com/apps/autogenpb
+//go:generate autogenpb --proto block.proto
+// # go:generate go get golang.org/x/tools # repo seems broken at this time (?)
+// # go:generate go install -v golang.org/x/tools/cmd/goimports
+//go:generate bash -c "goimports -w *.go"