From 0a823f87a77a53ba73a3c05d69b08fb24e5f14ee Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 8 Oct 2025 02:58:19 -0500 Subject: typos --- Makefile | 12 +++++++++++- generate.go | 15 +++++++++++++++ helpers.go | 4 ++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 generate.go diff --git a/Makefile b/Makefile index 35867ad..5aac59a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,14 @@ -all: clean chat.pb.go book.pb.go goimports vet +all: goimports vet + +generate: clean + go mod init + go mod tidy + go generate + +go-generate: + rm -f *.pb.go *.patch + +# all: clean chat.pb.go book.pb.go goimports vet goimports: goimports -w *.go diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..b74baec --- /dev/null +++ b/generate.go @@ -0,0 +1,15 @@ +package chatpb + +// 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 chat.proto +//go:generate autogenpb --proto book.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/helpers.go b/helpers.go index 27f6a73..26806f5 100644 --- a/helpers.go +++ b/helpers.go @@ -96,8 +96,8 @@ func (x *Chats) AppendNew(y *Chat) { // a Append() shortcut (that does Clone() with a mutex) notsure if it really works func (x *Chat) AppendEntry(y *ChatEntry) { - x.Lock() - defer x.Unlock() + chatMu.Lock() + defer chatMu.Unlock() x.Entries = append(x.Entries, proto.Clone(y).(*ChatEntry)) } -- cgit v1.2.3