diff options
| author | Jeff Carr <[email protected]> | 2025-02-01 07:42:53 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-01 07:42:53 -0600 |
| commit | f2a296064e6befbce4b584f24d474a8ade2c5215 (patch) | |
| tree | f1e14a182b6eac5a9b6d4871be40adbbabb3658f | |
| parent | f4b0273fc18af689c9fa06d35e24951a6590756a (diff) | |
start toying with a protobuf herev0.22.5
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 12 | ||||
| -rw-r--r-- | widget.proto | 36 |
3 files changed, 49 insertions, 0 deletions
@@ -1,3 +1,4 @@ *.swp go.sum go.mod +*.pb.go @@ -3,6 +3,12 @@ all: @echo "Run: make redomod # to remake the go files" @echo +redo: clean proto goimports vet + +vet: + @GO111MODULE=off go vet + @echo this go plugin package builds okay + redomod: goimports rm -f go.* GO111MODULE= go mod init @@ -10,3 +16,9 @@ redomod: goimports goimports: goimports -w *.go + +proto: + autogenpb --proto widget.proto + +clean: + rm -f go.* *.pb.go diff --git a/widget.proto b/widget.proto new file mode 100644 index 0000000..371c288 --- /dev/null +++ b/widget.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +// playing around with ideas here + +package main; + +import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp + +message Size { + int64 width = 1; + int64 height = 2; +} + +message Location { + int64 x = 1; + int64 y = 2; +} + +message Tree { + Widget parent = 1; + repeated Widget children = 2; +} + +message Widget { + int64 id = 1; + string name = 2; + Size size = 3; + Location location = 4; + string color = 5; +} + +message Widgets { + string uuid = 1; // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c` + string version = 2; // `autogenpb:version:v1` + repeated Widget Widgets = 3; +} |
