@aptre/common 0.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js ADDED
@@ -0,0 +1,28 @@
1
+ module.exports = {
2
+ root: true,
3
+ parser: '@typescript-eslint/parser',
4
+ plugins: ['@typescript-eslint', 'unused-imports'],
5
+ extends: [
6
+ 'eslint:recommended',
7
+ 'plugin:@typescript-eslint/recommended',
8
+ 'plugin:react-hooks/recommended',
9
+ 'prettier',
10
+ ],
11
+ parserOptions: {
12
+ project: './tsconfig.json',
13
+ },
14
+ rules: {
15
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
16
+ '@typescript-eslint/no-non-null-assertion': 'off',
17
+ },
18
+ ignorePatterns: [
19
+ "node_modules",
20
+ "dist",
21
+ "coverage",
22
+ "bundle",
23
+ "runtime",
24
+ "vendor",
25
+ ".eslintrc.js",
26
+ "wasm_exec.js"
27
+ ]
28
+ }
package/.gitignore ADDED
@@ -0,0 +1,26 @@
1
+ /node_modules
2
+ /coverage
3
+ /build
4
+ /.log
5
+ /.tools
6
+ /.aider*
7
+
8
+ # misc
9
+ .DS_Store
10
+ .env.local
11
+ .env.development.local
12
+ .env.test.local
13
+ .env.production.local
14
+
15
+ npm-debug.log*
16
+ yarn-debug.log*
17
+ yarn-error.log*
18
+
19
+ .#*
20
+ debug.test*
21
+ /dist
22
+ .*.swp
23
+ .vs/
24
+ .vscode/
25
+ !.vscode/launch.json
26
+ /vendor/
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2022 Aperture Robotics, LLC. <christian@aperture.us>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/Makefile ADDED
@@ -0,0 +1,193 @@
1
+ # https://github.com/aperturerobotics/template
2
+
3
+ # Projects can override PROJECT_DIR with the path to their project.
4
+ COMMON_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
5
+ PROJECT_DIR := $(COMMON_DIR)
6
+ PROJECT_DIR_REL = $(shell realpath --relative-to $(COMMON_DIR) $(PROJECT_DIR))
7
+
8
+ TOOLS_DIR := .tools
9
+ TOOLS_BIN := $(TOOLS_DIR)/bin
10
+ PROJECT_TOOLS_DIR := $(PROJECT_DIR)/.tools
11
+ PROJECT_TOOLS_DIR_REL = $(shell realpath --relative-to $(COMMON_DIR) $(PROJECT_TOOLS_DIR))
12
+
13
+ SHELL:=bash
14
+ MAKEFLAGS += --no-print-directory
15
+
16
+ export GO111MODULE=on
17
+ undefine GOARCH
18
+ undefine GOOS
19
+
20
+ .PHONY: all
21
+ all: protodeps
22
+
23
+ # Setup node_modules
24
+ $(PROJECT_DIR)/node_modules:
25
+ cd $(PROJECT_DIR_REL); yarn install
26
+
27
+ # Setup the .tools directory to hold the build tools in the project repo
28
+ $(PROJECT_TOOLS_DIR):
29
+ @cd $(PROJECT_DIR); go run -v github.com/aperturerobotics/common $(TOOLS_DIR)
30
+
31
+ # Build tool rule
32
+ define build_tool
33
+ $(PROJECT_DIR)/$(1): $(PROJECT_TOOLS_DIR)
34
+ cd $(PROJECT_TOOLS_DIR_REL); \
35
+ go build -mod=readonly -v \
36
+ -o ./bin/$(shell basename $(1)) \
37
+ $(2)
38
+
39
+ .PHONY: $(1)
40
+ $(1): $(PROJECT_DIR)/$(1)
41
+ endef
42
+
43
+ # List of available Go tool binaries
44
+ PROTOWRAP=$(TOOLS_BIN)/protowrap
45
+ PROTOC_GEN_GO=$(TOOLS_BIN)/protoc-gen-go-lite
46
+ PROTOC_GEN_GO_STARPC=$(TOOLS_BIN)/protoc-gen-go-starpc
47
+ GOIMPORTS=$(TOOLS_BIN)/goimports
48
+ GOFUMPT=$(TOOLS_BIN)/gofumpt
49
+ GOLANGCI_LINT=$(TOOLS_BIN)/golangci-lint
50
+ GO_MOD_OUTDATED=$(TOOLS_BIN)/go-mod-outdated
51
+ GORELEASER=$(TOOLS_BIN)/goreleaser
52
+
53
+ # Mappings for build tool to Go import path
54
+ $(eval $(call build_tool,$(PROTOC_GEN_GO),github.com/aperturerobotics/protobuf-go-lite/cmd/protoc-gen-go-lite))
55
+ $(eval $(call build_tool,$(PROTOC_GEN_GO_STARPC),github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc))
56
+ $(eval $(call build_tool,$(GOIMPORTS),golang.org/x/tools/cmd/goimports))
57
+ $(eval $(call build_tool,$(GOFUMPT),mvdan.cc/gofumpt))
58
+ $(eval $(call build_tool,$(PROTOWRAP),github.com/aperturerobotics/goprotowrap/cmd/protowrap))
59
+ $(eval $(call build_tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint))
60
+ $(eval $(call build_tool,$(GO_MOD_OUTDATED),github.com/psampaz/go-mod-outdated))
61
+ $(eval $(call build_tool,$(GORELEASER),github.com/goreleaser/goreleaser))
62
+
63
+ .PHONY: protodeps
64
+ protodeps: $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_STARPC) $(PROJECT_DIR)/node_modules
65
+
66
+ # Default protogen targets and arguments
67
+ PROTOGEN_TARGETS ?= ./*.proto
68
+ PROTOGEN_ARGS ?=
69
+ GO_LITE_OPT_FEATURES ?= marshal+unmarshal+size+equal+json+clone+text
70
+
71
+ .PHONY: genproto
72
+ genproto: protodeps
73
+ @shopt -s globstar; \
74
+ set -eo pipefail; \
75
+ cd $(PROJECT_DIR); \
76
+ export PROJECT=$$(go list -m); \
77
+ export OUT=./vendor; \
78
+ mkdir -p $${OUT}/$$(dirname $${PROJECT}); \
79
+ rm -f ./vendor/$${PROJECT}; \
80
+ ln -s $$(pwd) ./vendor/$${PROJECT}; \
81
+ protogen() { \
82
+ PROTO_FILES=$$(git ls-files "$$1"); \
83
+ FMT_GO_FILES=(); \
84
+ FMT_TS_FILES=(); \
85
+ $(PROTOWRAP) \
86
+ -I $${OUT} \
87
+ --plugin=$(PROTOC_GEN_GO) \
88
+ --plugin=$(PROTOC_GEN_GO_STARPC) \
89
+ --plugin=./node_modules/.bin/protoc-gen-es \
90
+ --plugin=./node_modules/.bin/protoc-gen-es-starpc \
91
+ --go-lite_out=$${OUT} \
92
+ --go-lite_opt=features=$(GO_LITE_OPT_FEATURES) \
93
+ --go-starpc_out=$${OUT} \
94
+ --es_out=$${OUT} \
95
+ --es_opt target=ts \
96
+ --es_opt ts_nocheck=false \
97
+ --es-starpc_out=$${OUT} \
98
+ --es-starpc_opt target=ts \
99
+ --es-starpc_opt ts_nocheck=false \
100
+ --proto_path $${OUT} \
101
+ --print_structure \
102
+ --only_specified_files \
103
+ $(PROTOGEN_ARGS) \
104
+ $$(echo "$$PROTO_FILES" | xargs printf -- "./vendor/$${PROJECT}/%s "); \
105
+ for proto_file in $${PROTO_FILES}; do \
106
+ proto_dir=$$(dirname $$proto_file); \
107
+ proto_name=$${proto_file%".proto"}; \
108
+ GO_FILES=$$(git ls-files ":(glob)$${proto_dir}/${proto_name}*.pb.go"); \
109
+ if [ -n "$$GO_FILES" ]; then FMT_GO_FILES+=($${GO_FILES[@]}); fi; \
110
+ TS_FILES=$$(git ls-files ":(glob)$${proto_dir}/${proto_name}*_*pb.ts"); \
111
+ if [ -n "$$TS_FILES" ]; then FMT_TS_FILES+=($${TS_FILES[@]}); fi; \
112
+ if [ -z "$$TS_FILES" ]; then continue; fi; \
113
+ for ts_file in $${TS_FILES}; do \
114
+ ts_file_dir=$$(dirname $$ts_file); \
115
+ relative_path=$${ts_file_dir#"./"}; \
116
+ depth=$$(echo $$relative_path | awk -F/ '{print NF+1}'); \
117
+ prefix=$$(printf '../%0.s' $$(seq 1 $$depth)); \
118
+ istmts=$$(grep -oE "from\s+\"$$prefix[^\"]+\"" $$ts_file) || continue; \
119
+ if [ -z "$$istmts" ]; then continue; fi; \
120
+ ipaths=$$(echo "$$istmts" | awk -F'"' '{print $$2}'); \
121
+ for import_path in $$ipaths; do \
122
+ rel_import_path=$$(realpath -s --relative-to=./vendor \
123
+ "./vendor/$${PROJECT}/$${ts_file_dir}/$${import_path}"); \
124
+ go_import_path=$$(echo $$rel_import_path | sed -e "s|^|@go/|"); \
125
+ sed -i -e "s|$$import_path|$$go_import_path|g" $$ts_file; \
126
+ done; \
127
+ done; \
128
+ done; \
129
+ if [ -n "$${FMT_GO_FILES}" ]; then \
130
+ $(GOIMPORTS) -w $${FMT_GO_FILES[@]}; \
131
+ fi; \
132
+ if [ -n "$${FMT_TS_FILES}" ]; then \
133
+ prettier --config $(TOOLS_DIR)/.prettierrc.yaml -w $${FMT_TS_FILES[@]}; \
134
+ fi; \
135
+ }; \
136
+ protogen "$(PROTOGEN_TARGETS)"; \
137
+ rm -f ./vendor/$${PROJECT}
138
+
139
+ .PHONY: gen
140
+ gen: genproto
141
+
142
+ .PHONY: outdated
143
+ outdated: $(GO_MOD_OUTDATED)
144
+ cd $(PROJECT_DIR); \
145
+ go list -mod=mod -u -m -json all | $(GO_MOD_OUTDATED) -update -direct
146
+
147
+ .PHONY: list
148
+ list: $(GO_MOD_OUTDATED)
149
+ cd $(PROJECT_DIR); \
150
+ go list -mod=mod -u -m -json all | $(GO_MOD_OUTDATED)
151
+
152
+ .PHONY: lint
153
+ lint: $(GOLANGCI_LINT)
154
+ cd $(PROJECT_DIR); \
155
+ $(GOLANGCI_LINT) run
156
+
157
+ .PHONY: fix
158
+ fix: $(GOLANGCI_LINT)
159
+ cd $(PROJECT_DIR); \
160
+ $(GOLANGCI_LINT) run --fix
161
+
162
+ .PHONY: test
163
+ test:
164
+ cd $(PROJECT_DIR); \
165
+ go test -v ./...
166
+
167
+ .PHONY: format
168
+ format: $(GOFUMPT) $(GOIMPORTS)
169
+ cd $(PROJECT_DIR); \
170
+ $(GOIMPORTS) -w ./; \
171
+ $(GOFUMPT) -w ./
172
+
173
+ .PHONY: release
174
+ release: $(GORELEASER)
175
+ cd $(PROJECT_DIR); \
176
+ $(GORELEASER) release $(GORELEASER_OPTS)
177
+
178
+ .PHONY: release-bundl\e
179
+ release-bundle: $(GORELEASER)
180
+ cd $(PROJECT_DIR); \
181
+ $(GORELEASER) check; \
182
+ $(GORELEASER) release --snapshot --clean --skip-publish $(GORELEASER_OPTS)
183
+
184
+ .PHONY: release-build
185
+ release-build: $(GORELEASER)
186
+ cd $(PROJECT_DIR); \
187
+ $(GORELEASER) check; \
188
+ $(GORELEASER) build --single-target --snapshot --clean $(GORELEASER_OPTS)
189
+
190
+ .PHONY: release-check
191
+ release-check: $(GORELEASER)
192
+ cd $(PROJECT_DIR); \
193
+ $(GORELEASER) check
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ ## Common
2
+
3
+ This contains common files like the project Makefile.
4
+
5
+ See [template] for a project template that uses this package.
6
+
7
+ [template]: https://github.com/aperturerobotics/template
8
+
9
+ See [protobuf-project] for a more extensive example.
10
+
11
+ [protobuf-project]: https://github.com/aperturerobotics/protobuf-project
12
+
13
+ ## Usage
14
+
15
+ Start by downloading the dependencies:
16
+
17
+ ```bash
18
+ yarn
19
+ ```
20
+
21
+ Protobuf imports use Go paths and package names:
22
+
23
+ ```protobuf
24
+ syntax = "proto3";
25
+ package example;
26
+
27
+ // Import .proto files using Go-style import paths.
28
+ import "github.com/aperturerobotics/controllerbus/controller/controller.proto";
29
+
30
+ // GetBusInfoResponse is the response type for GetBusInfo.
31
+ message GetBusInfoResponse {
32
+ // RunningControllers is the list of running controllers.
33
+ repeated controller.Info running_controllers = 1;
34
+ }
35
+ ```
36
+
37
+ To generate the protobuf files:
38
+
39
+ ```bash
40
+ $ git add -A
41
+ $ yarn gen
42
+ ```
43
+
44
+ The Makefile will download the tools using Go to a bin dir.
45
+
46
+ ## Makefile
47
+
48
+ The available make targets are:
49
+
50
+ - `genproto`: Generate protobuf files.
51
+ - `test`: run go test -v ./...
52
+ - `lint`: run golangci-lint on the project.
53
+ - `fix`: run golangci-lint --fix on the project.
54
+ - `list`: list go module dependencies
55
+ - `outdated`: list outdated go module dependencies
56
+
57
+ To generate the TypeScript and Go code:
58
+
59
+ - `yarn gen`
60
+
61
+ To format the Go and TypeScript files:
62
+
63
+ - `yarn format`
64
+
65
+ ## Eject
66
+
67
+ You can "eject" and copy all the project files directly to your repo:
68
+
69
+ ```
70
+ # NOTE: not a full list of files
71
+ cp ./vendor/github.com/aperturerobotics/common/{Makefile,.eslintrc.js,.eslintignore} ./
72
+ ```
73
+
74
+ While not implemented yet, "make eject" will do this for you.
75
+
76
+ ## Developing on MacOS
77
+
78
+ On MacOS, some homebrew packages are required for `yarn gen`:
79
+
80
+ ```
81
+ brew install bash make coreutils gnu-sed findutils protobuf
82
+ brew link --overwrite protobuf
83
+ ```
84
+
85
+ Add to your .bashrc or .zshrc:
86
+
87
+ ```
88
+ export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
89
+ export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
90
+ export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"
91
+ export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"
92
+ ```
93
+
94
+ ## Support
95
+
96
+ Please open a [GitHub issue] with any questions / issues.
97
+
98
+ [GitHub issue]: https://github.com/aperturerobotics/common/issues/new
99
+
100
+ ... or feel free to reach out on [Matrix Chat] or [Discord].
101
+
102
+ [Discord]: https://discord.gg/KJutMESRsT
103
+ [Matrix Chat]: https://matrix.to/#/#aperturerobotics:matrix.org
104
+
105
+ ## License
106
+
107
+ MIT
package/deps.go.tools ADDED
@@ -0,0 +1,29 @@
1
+ //go:build deps_only
2
+ // +build deps_only
3
+
4
+ package hack
5
+
6
+ import (
7
+
8
+ // _ imports protowrap
9
+ _ "github.com/aperturerobotics/goprotowrap/cmd/protowrap"
10
+ // _ imports protoc-gen-go-lite
11
+ _ "github.com/aperturerobotics/protobuf-go-lite/cmd/protoc-gen-go-lite"
12
+ // _ imports protoc-gen-starpc
13
+ _ "github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc"
14
+
15
+ // _ imports golangci-lint
16
+ _ "github.com/golangci/golangci-lint/pkg/golinters"
17
+ // _ imports golangci-lint commands
18
+ _ "github.com/golangci/golangci-lint/pkg/commands"
19
+
20
+ // _ imports go-mod-outdated
21
+ _ "github.com/psampaz/go-mod-outdated"
22
+ // _ imports goimports
23
+ _ "golang.org/x/tools/cmd/goimports"
24
+ // _ imports gofumpt
25
+ _ "mvdan.cc/gofumpt"
26
+
27
+ // _ imports goreleaser
28
+ _ "github.com/goreleaser/goreleaser"
29
+ )
File without changes
package/dist/common.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,30 @@
1
+ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from '@bufbuild/protobuf';
2
+ import { Message, proto3 } from '@bufbuild/protobuf';
3
+ import { OtherMsg } from './other/other_pb.js';
4
+ /**
5
+ * ExampleMsg is an example message.
6
+ *
7
+ * @generated from message example.ExampleMsg
8
+ */
9
+ export declare class ExampleMsg extends Message<ExampleMsg> {
10
+ /**
11
+ * ExampleField is an example field.
12
+ *
13
+ * @generated from field: string example_field = 1;
14
+ */
15
+ exampleField: string;
16
+ /**
17
+ * OtherMsg is an example of an imported message field.
18
+ *
19
+ * @generated from field: example.other.OtherMsg other_msg = 2;
20
+ */
21
+ otherMsg?: OtherMsg;
22
+ constructor(data?: PartialMessage<ExampleMsg>);
23
+ static readonly runtime: typeof proto3;
24
+ static readonly typeName = "example.ExampleMsg";
25
+ static readonly fields: FieldList;
26
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ExampleMsg;
27
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ExampleMsg;
28
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ExampleMsg;
29
+ static equals(a: ExampleMsg | PlainMessage<ExampleMsg> | undefined, b: ExampleMsg | PlainMessage<ExampleMsg> | undefined): boolean;
30
+ }
@@ -0,0 +1,51 @@
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
+ // @generated from file github.com/aperturerobotics/common/example/example.proto (package example, syntax proto3)
3
+ /* eslint-disable */
4
+ import { Message, proto3 } from '@bufbuild/protobuf';
5
+ import { OtherMsg } from './other/other_pb.js';
6
+ /**
7
+ * ExampleMsg is an example message.
8
+ *
9
+ * @generated from message example.ExampleMsg
10
+ */
11
+ export class ExampleMsg extends Message {
12
+ /**
13
+ * ExampleField is an example field.
14
+ *
15
+ * @generated from field: string example_field = 1;
16
+ */
17
+ exampleField = '';
18
+ /**
19
+ * OtherMsg is an example of an imported message field.
20
+ *
21
+ * @generated from field: example.other.OtherMsg other_msg = 2;
22
+ */
23
+ otherMsg;
24
+ constructor(data) {
25
+ super();
26
+ proto3.util.initPartial(data, this);
27
+ }
28
+ static runtime = proto3;
29
+ static typeName = 'example.ExampleMsg';
30
+ static fields = proto3.util.newFieldList(() => [
31
+ {
32
+ no: 1,
33
+ name: 'example_field',
34
+ kind: 'scalar',
35
+ T: 9 /* ScalarType.STRING */,
36
+ },
37
+ { no: 2, name: 'other_msg', kind: 'message', T: OtherMsg },
38
+ ]);
39
+ static fromBinary(bytes, options) {
40
+ return new ExampleMsg().fromBinary(bytes, options);
41
+ }
42
+ static fromJson(jsonValue, options) {
43
+ return new ExampleMsg().fromJson(jsonValue, options);
44
+ }
45
+ static fromJsonString(jsonString, options) {
46
+ return new ExampleMsg().fromJsonString(jsonString, options);
47
+ }
48
+ static equals(a, b) {
49
+ return proto3.util.equals(ExampleMsg, a, b);
50
+ }
51
+ }
@@ -0,0 +1,23 @@
1
+ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from '@bufbuild/protobuf';
2
+ import { Message, proto3 } from '@bufbuild/protobuf';
3
+ /**
4
+ * OtherMsg is a different message from ExampleMsg.
5
+ *
6
+ * @generated from message example.other.OtherMsg
7
+ */
8
+ export declare class OtherMsg extends Message<OtherMsg> {
9
+ /**
10
+ * FooField is an example field.
11
+ *
12
+ * @generated from field: uint32 foo_field = 1;
13
+ */
14
+ fooField: number;
15
+ constructor(data?: PartialMessage<OtherMsg>);
16
+ static readonly runtime: typeof proto3;
17
+ static readonly typeName = "example.other.OtherMsg";
18
+ static readonly fields: FieldList;
19
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): OtherMsg;
20
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): OtherMsg;
21
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OtherMsg;
22
+ static equals(a: OtherMsg | PlainMessage<OtherMsg> | undefined, b: OtherMsg | PlainMessage<OtherMsg> | undefined): boolean;
23
+ }
@@ -0,0 +1,38 @@
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
+ // @generated from file github.com/aperturerobotics/common/example/other/other.proto (package example.other, syntax proto3)
3
+ /* eslint-disable */
4
+ import { Message, proto3 } from '@bufbuild/protobuf';
5
+ /**
6
+ * OtherMsg is a different message from ExampleMsg.
7
+ *
8
+ * @generated from message example.other.OtherMsg
9
+ */
10
+ export class OtherMsg extends Message {
11
+ /**
12
+ * FooField is an example field.
13
+ *
14
+ * @generated from field: uint32 foo_field = 1;
15
+ */
16
+ fooField = 0;
17
+ constructor(data) {
18
+ super();
19
+ proto3.util.initPartial(data, this);
20
+ }
21
+ static runtime = proto3;
22
+ static typeName = 'example.other.OtherMsg';
23
+ static fields = proto3.util.newFieldList(() => [
24
+ { no: 1, name: 'foo_field', kind: 'scalar', T: 13 /* ScalarType.UINT32 */ },
25
+ ]);
26
+ static fromBinary(bytes, options) {
27
+ return new OtherMsg().fromBinary(bytes, options);
28
+ }
29
+ static fromJson(jsonValue, options) {
30
+ return new OtherMsg().fromJson(jsonValue, options);
31
+ }
32
+ static fromJsonString(jsonString, options) {
33
+ return new OtherMsg().fromJsonString(jsonString, options);
34
+ }
35
+ static equals(a, b) {
36
+ return proto3.util.equals(OtherMsg, a, b);
37
+ }
38
+ }
package/go.mod ADDED
@@ -0,0 +1,16 @@
1
+ module github.com/aperturerobotics/common
2
+
3
+ go 1.22
4
+
5
+ toolchain go1.22.2
6
+
7
+ require (
8
+ github.com/aperturerobotics/protobuf-go-lite v0.5.0 // latest
9
+ github.com/pkg/errors v0.9.1
10
+ )
11
+
12
+ require (
13
+ github.com/json-iterator/go v1.1.12 // indirect
14
+ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
15
+ github.com/modern-go/reflect2 v1.0.2 // indirect
16
+ )