From 3050d6113b89ce885640ad89d3516e3ec8e8a2cb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 7 Oct 2025 18:27:02 -0500 Subject: kinda "make generate" --- Makefile | 22 ++++++++++++---------- generate.go | 15 +++++++++++++++ table.custom.go | 6 ++---- 3 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 generate.go diff --git a/Makefile b/Makefile index 32a9866..c8a113e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,16 @@ -all: proto goimports vet +all: generate -redo: clean proto goimports vet +generate: clean + go mod init + go mod tidy + go generate + +go-generate: + rm -f *.pb.go *.patch + +proto: + autogenpb --proto widget.proto + autogenpb --proto table.proto vet: @GO111MODULE=off go vet @@ -9,13 +19,5 @@ vet: goimports: goimports -w *.go -proto: widget.pb.go table.pb.go - -widget.pb.go: widget.proto - autogenpb --proto widget.proto - -table.pb.go: table.proto - autogenpb --proto table.proto - clean: rm -f go.* *.pb.go diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..9053df6 --- /dev/null +++ b/generate.go @@ -0,0 +1,15 @@ +package guipb + +// 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 # can't do this here since this repo is a GO "primitive" library (no deps) +// # go:generate go install -v go.wit.com/apps/autogenpb +//go:generate autogenpb --proto widget.proto +//go:generate autogenpb --proto table.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" diff --git a/table.custom.go b/table.custom.go index abed9a5..c8672ae 100644 --- a/table.custom.go +++ b/table.custom.go @@ -10,17 +10,15 @@ package guipb -import "go.wit.com/log" - func (pb *Tables) Custom(w *Widget) { - log.Info("got to guipb.Custom() for pb", pb.GetUuid(), "widget id", w) + // log.Info("got to guipb.Custom() for pb", pb.GetUuid(), "widget id", w) if mycustom != nil { mycustom(w) } } func (pb *Table) Custom(w *Widget) { - log.Info("got to guipb.Custom() for pb", pb.GetUuid(), "widget id", w) + // log.Info("got to guipb.Custom() for pb", pb.GetUuid(), "widget id", w) if mycustom != nil { mycustom(w) } -- cgit v1.2.3