diff options
| author | Jeff Carr <[email protected]> | 2025-10-08 02:58:19 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-08 02:58:19 -0500 |
| commit | 0a823f87a77a53ba73a3c05d69b08fb24e5f14ee (patch) | |
| tree | a2eea413696c9e148d6ac2c57221bfcc0ae48505 | |
| parent | 14edae96ad6876121b7fdb51505c9e23b72a1f98 (diff) | |
typosv0.0.19
| -rw-r--r-- | Makefile | 12 | ||||
| -rw-r--r-- | generate.go | 15 | ||||
| -rw-r--r-- | helpers.go | 4 |
3 files changed, 28 insertions, 3 deletions
@@ -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" @@ -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)) } |
