├── buf.yaml ├── buf.go.yaml ├── .gitignore ├── .bingo ├── go.mod ├── bingo.mod ├── buf.mod ├── protoc-gen-go.mod ├── protoc-gen-debug.mod ├── .gitignore ├── protoc-gen-go.sum ├── variables.env ├── README.md ├── Variables.mk ├── bingo.sum ├── protoc-gen-debug.sum └── buf.sum ├── .clang-format ├── buf.gen.yaml ├── go.mod ├── tests ├── pb │ ├── test.extensions.go │ ├── test.proto │ ├── types.proto │ ├── test.pb.defaults.go │ ├── types.pb.defaults.go │ ├── types.pb.go │ └── test.pb.go └── defaults_test.go ├── main.go ├── debug └── debug_test.go ├── Makefile ├── defaults ├── defaults.proto ├── defaults.extensions.go └── defaults.pb.go ├── module ├── module.go ├── defaults.go └── checker.go ├── README.md └── LICENCE /buf.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | modules: 3 | - path: . 4 | name: buf.build/linka-cloud/protoc-gen-defaults 5 | -------------------------------------------------------------------------------- /buf.go.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | plugins: 3 | - local: protoc-gen-go 4 | out: . 5 | opt: 6 | - paths=source_relative 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .clang-format 3 | .bin 4 | /debug/code_generator_request.pb.bin 5 | /defaults/defaults.pb.defaults.go 6 | 7 | dist/ 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /.bingo/go.mod: -------------------------------------------------------------------------------- 1 | module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. -------------------------------------------------------------------------------- /.bingo/bingo.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.23.2 4 | 5 | require github.com/bwplotka/bingo v0.9.0 6 | -------------------------------------------------------------------------------- /.bingo/buf.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.23.2 4 | 5 | require github.com/bufbuild/buf v1.45.0 // cmd/buf 6 | -------------------------------------------------------------------------------- /.bingo/protoc-gen-go.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.23.2 4 | 5 | require github.com/golang/protobuf v1.5.4 // protoc-gen-go 6 | -------------------------------------------------------------------------------- /.bingo/protoc-gen-debug.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.23.2 4 | 5 | require github.com/lyft/protoc-gen-star v0.6.2 // protoc-gen-debug 6 | -------------------------------------------------------------------------------- /.bingo/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Ignore everything 3 | * 4 | 5 | # But not these files: 6 | !.gitignore 7 | !*.mod 8 | !*.sum 9 | !README.md 10 | !Variables.mk 11 | !variables.env 12 | 13 | *tmp.mod 14 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | ColumnLimit: 2048 4 | IndentWidth: 8 5 | UseTab: ForIndentation 6 | SpacesBeforeTrailingComments: 1 7 | --- 8 | Language: Proto 9 | Cpp11BracedListStyle: true 10 | --- 11 | 12 | -------------------------------------------------------------------------------- /buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | plugins: 3 | - local: protoc-gen-go 4 | out: . 5 | opt: 6 | - paths=source_relative 7 | - local: protoc-gen-defaults 8 | out: . 9 | opt: 10 | - paths=source_relative 11 | - local: protoc-gen-debug 12 | out: . 13 | opt: 14 | - debug 15 | 16 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module go.linka.cloud/protoc-gen-defaults 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/golang/protobuf v1.5.2 7 | github.com/lyft/protoc-gen-star v0.6.0 8 | github.com/prometheus/common v0.29.0 9 | github.com/stretchr/testify v1.7.0 10 | google.golang.org/protobuf v1.26.0 11 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect 12 | ) 13 | -------------------------------------------------------------------------------- /.bingo/protoc-gen-go.sum: -------------------------------------------------------------------------------- 1 | github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= 2 | github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 3 | google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= 4 | google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 5 | -------------------------------------------------------------------------------- /.bingo/variables.env: -------------------------------------------------------------------------------- 1 | # Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. 2 | # All tools are designed to be build inside $GOBIN. 3 | # Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. 4 | GOBIN=${GOBIN:=$(go env GOBIN)} 5 | 6 | if [ -z "$GOBIN" ]; then 7 | GOBIN="$(go env GOPATH)/bin" 8 | fi 9 | 10 | 11 | BINGO="${GOBIN}/bingo-v0.9.0" 12 | 13 | BUF="${GOBIN}/buf-v1.45.0" 14 | 15 | PROTOC_GEN_DEBUG="${GOBIN}/protoc-gen-debug-v0.6.2" 16 | 17 | PROTOC_GEN_GO="${GOBIN}/protoc-gen-go-v1.5.4" 18 | 19 | -------------------------------------------------------------------------------- /tests/pb/test.extensions.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pb 16 | 17 | func (x *TestUnexported) Default() { 18 | x._Default() 19 | } 20 | -------------------------------------------------------------------------------- /.bingo/README.md: -------------------------------------------------------------------------------- 1 | # Project Development Dependencies. 2 | 3 | This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. 4 | 5 | * Run `bingo get` to install all tools having each own module file in this directory. 6 | * Run `bingo get ` to install that have own module file in this directory. 7 | * For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. 8 | * For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. 9 | * For go: Import `.bingo/variables.go` to for variable names. 10 | * See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. 11 | 12 | ## Requirements 13 | 14 | * Go 1.14+ 15 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | pgs "github.com/lyft/protoc-gen-star" 19 | pgsgo "github.com/lyft/protoc-gen-star/lang/go" 20 | "google.golang.org/protobuf/types/pluginpb" 21 | 22 | "go.linka.cloud/protoc-gen-defaults/module" 23 | ) 24 | 25 | func main() { 26 | feat := uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) 27 | pgs.Init( 28 | pgs.DebugEnv("DEBUG"), 29 | pgs.SupportedFeatures(&feat), 30 | ).RegisterModule( 31 | module.Defaults(), 32 | ).RegisterPostProcessor( 33 | pgsgo.GoFmt(), 34 | ).Render() 35 | } 36 | -------------------------------------------------------------------------------- /debug/debug_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package debug 16 | 17 | import ( 18 | "bytes" 19 | "os" 20 | "testing" 21 | 22 | pgs "github.com/lyft/protoc-gen-star" 23 | pgsgo "github.com/lyft/protoc-gen-star/lang/go" 24 | "github.com/stretchr/testify/require" 25 | 26 | "go.linka.cloud/protoc-gen-defaults/module" 27 | ) 28 | 29 | func TestDebugGen(t *testing.T) { 30 | require := require.New(t) 31 | f, err := os.Open("code_generator_request.pb.bin") 32 | require.NoError(err) 33 | defer f.Close() 34 | out := &bytes.Buffer{} 35 | pgs.Init( 36 | pgs.ProtocInput(f), 37 | pgs.ProtocOutput(out), 38 | pgs.DebugMode(), 39 | ).RegisterModule( 40 | module.Defaults(), 41 | ).RegisterPostProcessor( 42 | pgsgo.GoFmt(), 43 | ).Render() 44 | } 45 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Linka Cloud All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | MODULE = go.linka.cloud/protoc-gen-defaults 16 | 17 | DEFAULTS_PROTO = defaults/defaults.proto 18 | 19 | $(shell mkdir -p .bin) 20 | 21 | export GOBIN=$(PWD)/.bin 22 | 23 | export PATH := $(GOBIN):$(PATH) 24 | 25 | include .bingo/Variables.mk 26 | 27 | bin: 28 | @go install github.com/bwplotka/bingo@latest 29 | @bingo get -l 30 | 31 | clean: 32 | @rm -rf .bin 33 | @find . -name '*.pb*.go' -type f -exec rm {} \; 34 | 35 | .PHONY: proto 36 | proto: gen-proto lint 37 | 38 | .PHONY: gen-proto 39 | gen-proto: defaults-proto install 40 | @buf generate 41 | 42 | .PHONY: defaults-proto 43 | defaults-proto: bin 44 | @buf generate --template buf.go.yaml --path $(DEFAULTS_PROTO) 45 | 46 | .PHONY: lint 47 | lint: 48 | @goimports -w -local $(MODULE) $(PWD) 49 | @gofmt -w $(PWD) 50 | 51 | .PHONY: tests 52 | tests: proto 53 | @go test -v ./module 54 | @go test -v ./tests 55 | 56 | 57 | .PHONY: install 58 | install: 59 | @go install . 60 | 61 | .PHONY: gen-debug 62 | gen-debug: proto 63 | @protoc -I. --debug_out="debug:." tests/pb/test.proto 64 | -------------------------------------------------------------------------------- /.bingo/Variables.mk: -------------------------------------------------------------------------------- 1 | # Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. 2 | # All tools are designed to be build inside $GOBIN. 3 | BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) 4 | GOPATH ?= $(shell go env GOPATH) 5 | GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin 6 | GO ?= $(shell which go) 7 | 8 | # Below generated variables ensure that every time a tool under each variable is invoked, the correct version 9 | # will be used; reinstalling only if needed. 10 | # For example for bingo variable: 11 | # 12 | # In your main Makefile (for non array binaries): 13 | # 14 | #include .bingo/Variables.mk # Assuming -dir was set to .bingo . 15 | # 16 | #command: $(BINGO) 17 | # @echo "Running bingo" 18 | # @$(BINGO) 19 | # 20 | BINGO := $(GOBIN)/bingo-v0.9.0 21 | $(BINGO): $(BINGO_DIR)/bingo.mod 22 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 23 | @echo "(re)installing $(GOBIN)/bingo-v0.9.0" 24 | @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.9.0 "github.com/bwplotka/bingo" 25 | 26 | BUF := $(GOBIN)/buf-v1.45.0 27 | $(BUF): $(BINGO_DIR)/buf.mod 28 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 29 | @echo "(re)installing $(GOBIN)/buf-v1.45.0" 30 | @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=buf.mod -o=$(GOBIN)/buf-v1.45.0 "github.com/bufbuild/buf/cmd/buf" 31 | 32 | PROTOC_GEN_DEBUG := $(GOBIN)/protoc-gen-debug-v0.6.2 33 | $(PROTOC_GEN_DEBUG): $(BINGO_DIR)/protoc-gen-debug.mod 34 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 35 | @echo "(re)installing $(GOBIN)/protoc-gen-debug-v0.6.2" 36 | @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-debug.mod -o=$(GOBIN)/protoc-gen-debug-v0.6.2 "github.com/lyft/protoc-gen-star/protoc-gen-debug" 37 | 38 | PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go-v1.5.4 39 | $(PROTOC_GEN_GO): $(BINGO_DIR)/protoc-gen-go.mod 40 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 41 | @echo "(re)installing $(GOBIN)/protoc-gen-go-v1.5.4" 42 | @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-go.mod -o=$(GOBIN)/protoc-gen-go-v1.5.4 "github.com/golang/protobuf/protoc-gen-go" 43 | 44 | -------------------------------------------------------------------------------- /.bingo/bingo.sum: -------------------------------------------------------------------------------- 1 | github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= 2 | github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= 3 | github.com/bwplotka/bingo v0.9.0 h1:slnsdJYExR4iRalHR6/ZiYnr9vSazOuFGmc2LdX293g= 4 | github.com/bwplotka/bingo v0.9.0/go.mod h1:GxC/y/xbmOK5P29cn+B3HuOSw0s2gruddT3r+rDizDw= 5 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 6 | github.com/efficientgo/core v1.0.0-rc.0 h1:jJoA0N+C4/knWYVZ6GrdHOtDyrg8Y/TR4vFpTaqTsqs= 7 | github.com/efficientgo/core v1.0.0-rc.0/go.mod h1:kQa0V74HNYMfuJH6jiPiwNdpWXl4xd/K4tzlrcvYDQI= 8 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 9 | github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= 10 | github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 11 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 12 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 13 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 14 | github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= 15 | github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= 16 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 17 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 18 | golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= 19 | golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 20 | golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= 21 | golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 22 | golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= 23 | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 24 | golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= 25 | golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= 26 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 27 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 28 | mvdan.cc/sh/v3 v3.7.0 h1:lSTjdP/1xsddtaKfGg7Myu7DnlHItd3/M2tomOcNNBg= 29 | mvdan.cc/sh/v3 v3.7.0/go.mod h1:K2gwkaesF/D7av7Kxl0HbF5kGOd2ArupNTX3X44+8l8= 30 | -------------------------------------------------------------------------------- /defaults/defaults.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto2"; 16 | package defaults; 17 | 18 | option go_package = "go.linka.cloud/protoc-gen-defaults/defaults;defaults"; 19 | 20 | import "google/protobuf/descriptor.proto"; 21 | 22 | // Defaults values applied at the message level 23 | extend google.protobuf.MessageOptions { 24 | // Disabled nullifies any defaults for this message, including any 25 | // message fields associated with it that do support defaults. 26 | optional bool disabled = 1171; 27 | // Ignore skips generation of default methods for this message. 28 | optional bool ignored = 1172; 29 | // Unexported generate an unexported defaults method, this can 30 | // be useful when we want both the generated defaults and a custom 31 | // defaults method that will call the unexported method. 32 | optional bool unexported = 1173; 33 | } 34 | 35 | // Defaults values applied at the oneof level 36 | extend google.protobuf.OneofOptions { 37 | optional string oneof = 1171; 38 | } 39 | 40 | // Defaults values applied at the field level 41 | extend google.protobuf.FieldOptions { 42 | // Value specify the default value to set on this field. By default, 43 | // none is set on a field. 44 | optional FieldDefaults value = 1171; 45 | } 46 | 47 | // FieldDefaults encapsulates the default values for each type of field. Depending on the 48 | // field, the correct set should be used to ensure proper defaults generation. 49 | message FieldDefaults { 50 | oneof type { 51 | // Scalar Field Types 52 | float float = 1; 53 | double double = 2; 54 | int32 int32 = 3; 55 | int64 int64 = 4; 56 | uint32 uint32 = 5; 57 | uint64 uint64 = 6; 58 | sint32 sint32 = 7; 59 | sint64 sint64 = 8; 60 | fixed32 fixed32 = 9; 61 | fixed64 fixed64 = 10; 62 | sfixed32 sfixed32 = 11; 63 | sfixed64 sfixed64 = 12; 64 | bool bool = 13; 65 | string string = 14; 66 | bytes bytes = 15; 67 | 68 | // Complex Field Types 69 | uint32 enum = 16; 70 | MessageDefaults message = 17; 71 | // repeated = 18; 72 | // map = 19; 73 | 74 | // Well-Known Field Types 75 | // any = 20; 76 | string duration = 21; 77 | string timestamp = 22; 78 | } 79 | reserved 18 to 20; 80 | } 81 | 82 | // MessageDefaults define the default behaviour for this field. 83 | message MessageDefaults { 84 | // Initialize specify that the message should be initialized 85 | optional bool initialize = 1; 86 | // Defaults specifies that the messages' defaults should be applied 87 | optional bool defaults = 2; 88 | } 89 | -------------------------------------------------------------------------------- /tests/pb/test.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package tests; 18 | 19 | option go_package = "go.linka.cloud/protoc-gen-defaults/tests/pb"; 20 | 21 | import "defaults/defaults.proto"; 22 | 23 | import "google/protobuf/wrappers.proto"; 24 | import "google/protobuf/timestamp.proto"; 25 | import "google/protobuf/duration.proto"; 26 | import "google/protobuf/descriptor.proto"; 27 | import "tests/pb/types.proto"; 28 | 29 | message Test { 30 | string string_field = 1 [(defaults.value).string = "string_field"]; 31 | int64 number_field = 2 [(defaults.value).int64 = 42]; 32 | bool bool_field = 3 [(defaults.value).bool = true]; 33 | enum Type { 34 | NONE = 0; 35 | ONE = 1; 36 | TWO = 2; 37 | } 38 | Type enum_field = 4 [(defaults.value).enum = 2]; 39 | Test message_field = 5 [(defaults.value).message = {defaults: true}]; 40 | repeated string repeated_string_field = 6; 41 | repeated Type repeated_message_field = 7; 42 | google.protobuf.Int64Value number_value_field = 8 [(defaults.value).int64 = 43]; 43 | google.protobuf.StringValue string_value_field = 9 [(defaults.value).string = "string_value"]; 44 | google.protobuf.BoolValue bool_value_field = 10 [(defaults.value).bool = false]; 45 | google.protobuf.Timestamp time_value_field = 11 [(defaults.value).timestamp = "now"]; 46 | google.protobuf.Duration duration_value_field = 12 [(defaults.value).duration = "42w"]; 47 | 48 | oneof oneof { 49 | option (defaults.oneof) = "two"; 50 | OneOfOne one = 13 [(defaults.value).message = {defaults: true, initialize: true}]; 51 | OneOfTwo two = 14 [(defaults.value).message = {defaults: true, initialize: true}]; 52 | OneOfThree three = 15 [(defaults.value).message = {defaults: true, initialize: true}]; 53 | Type four = 16 [(defaults.value).enum = 1]; 54 | } 55 | 56 | google.protobuf.DescriptorProto descriptor = 17 [(defaults.value).message = {defaults: true, initialize: true}]; 57 | google.protobuf.Timestamp time_value_field_with_default = 18 [(defaults.value).timestamp = "1952-03-11T00:00:00Z"]; 58 | bytes bytes = 19 [(defaults.value).bytes = "??"]; 59 | } 60 | 61 | message TestOptional { 62 | optional string string_field = 1 [(defaults.value).string = "string_field"]; 63 | optional int64 number_field = 2 [(defaults.value).int64 = 42]; 64 | optional bool bool_field = 3 [(defaults.value).bool = true]; 65 | enum Type { 66 | NONE = 0; 67 | ONE = 1; 68 | TWO = 2; 69 | } 70 | optional Type enum_field = 4 [(defaults.value).enum = 2]; 71 | } 72 | 73 | message TestUnexported { 74 | option (defaults.unexported) = true; 75 | optional string string_field = 1 [(defaults.value).string = "string_field"]; 76 | optional int64 number_field = 2 [(defaults.value).int64 = 42]; 77 | optional bool bool_field = 3 [(defaults.value).bool = true]; 78 | enum Type { 79 | NONE = 0; 80 | ONE = 1; 81 | TWO = 2; 82 | } 83 | optional Type enum_field = 4 [(defaults.value).enum = 2]; 84 | } 85 | -------------------------------------------------------------------------------- /tests/pb/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package tests; 18 | 19 | option go_package = "go.linka.cloud/protoc-gen-defaults/tests/pb;pb"; 20 | 21 | import "defaults/defaults.proto"; 22 | 23 | import "google/protobuf/wrappers.proto"; 24 | import "google/protobuf/timestamp.proto"; 25 | import "google/protobuf/duration.proto"; 26 | 27 | message Types { 28 | // Scalar Field Types 29 | float float = 1 [(defaults.value).float = 0.42]; 30 | double double = 2 [(defaults.value).double = 0.42]; 31 | int32 int32 = 3 [(defaults.value).int32 = 42]; 32 | int64 int64 = 4 [(defaults.value).int64 = 42]; 33 | uint32 uint32 = 5 [(defaults.value).uint32 = 42]; 34 | uint64 uint64 = 6 [(defaults.value).uint64 = 42]; 35 | sint32 sint32 = 7 [(defaults.value).sint32 = 42]; 36 | sint64 sint64 = 8 [(defaults.value).sint64 = 42]; 37 | fixed32 fixed32 = 9 [(defaults.value).fixed32 = 42]; 38 | fixed64 fixed64 = 10 [(defaults.value).fixed64 = 42]; 39 | sfixed32 sfixed32 = 11 [(defaults.value).sfixed32 = 42]; 40 | sfixed64 sfixed64 = 12 [(defaults.value).sfixed64 = 42]; 41 | bool bool = 13 [(defaults.value).bool = true]; 42 | string string = 14 [(defaults.value).string = "42"]; 43 | bytes bytes = 15 [(defaults.value).bytes = "42"]; 44 | 45 | // Complex Field Types 46 | enum Enum { 47 | NONE = 0; 48 | ONE = 1; 49 | TWO = 2; 50 | } 51 | Enum enum = 16 [(defaults.value).enum = 1]; 52 | Message message = 17 [(defaults.value).message = {initialize: true, defaults: false}]; 53 | oneof oneof { 54 | option (defaults.oneof) = "two"; 55 | OneOfOne one = 29 [(defaults.value).message = {defaults: true, initialize: true}]; 56 | OneOfTwo two = 30 [(defaults.value).message = {defaults: true, initialize: true}]; 57 | OneOfThree three = 31 [(defaults.value).message = {defaults: true, initialize: true}]; 58 | Enum four = 32 [(defaults.value).enum = 1]; 59 | } 60 | 61 | // WellKnow types 62 | google.protobuf.Duration duration = 18 [(defaults.value).duration = "2d"]; 63 | google.protobuf.Timestamp timestamp = 19 [(defaults.value).timestamp = "now"]; 64 | google.protobuf.DoubleValue double_value = 20 [(defaults.value).double = 0.42]; 65 | google.protobuf.FloatValue float_value = 21 [(defaults.value).float = 0.42]; 66 | google.protobuf.Int64Value int64_value = 22 [(defaults.value).int64 = 42]; 67 | google.protobuf.UInt64Value uint64_value = 23 [(defaults.value).uint64 = 42]; 68 | google.protobuf.Int32Value int32_value = 24 [(defaults.value).int32 = 42]; 69 | google.protobuf.UInt32Value uint32_value = 25 [(defaults.value).uint32 = 42]; 70 | google.protobuf.BoolValue bool_value = 26 [(defaults.value).bool = false]; 71 | google.protobuf.StringValue string_value = 27 [(defaults.value).string = "42"]; 72 | google.protobuf.BytesValue bytes_value = 28 [(defaults.value).bytes = "42"]; 73 | } 74 | 75 | message Message { 76 | string field = 1 [(defaults.value).string = "lonely field"]; 77 | } 78 | 79 | message OneOfOne { 80 | option (defaults.ignored) = true; 81 | string string_field = 1 [(defaults.value).string = "string_field"]; 82 | } 83 | 84 | message OneOfTwo { 85 | string string_field = 1 [(defaults.value).string = "string_field"]; 86 | } 87 | 88 | message OneOfThree { 89 | option (defaults.disabled) = true; 90 | string string_field = 1 [(defaults.value).string = "string_field"]; 91 | } 92 | -------------------------------------------------------------------------------- /tests/defaults_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tests 16 | 17 | import ( 18 | "testing" 19 | 20 | assert2 "github.com/stretchr/testify/assert" 21 | require2 "github.com/stretchr/testify/require" 22 | "google.golang.org/protobuf/proto" 23 | "google.golang.org/protobuf/types/descriptorpb" 24 | "google.golang.org/protobuf/types/known/durationpb" 25 | "google.golang.org/protobuf/types/known/timestamppb" 26 | "google.golang.org/protobuf/types/known/wrapperspb" 27 | 28 | "go.linka.cloud/protoc-gen-defaults/defaults" 29 | "go.linka.cloud/protoc-gen-defaults/tests/pb" 30 | ) 31 | 32 | var ( 33 | expect = &pb.Test{ 34 | StringField: "string_field", 35 | NumberField: 42, 36 | BoolField: true, 37 | EnumField: 2, 38 | MessageField: nil, 39 | RepeatedStringField: nil, 40 | RepeatedMessageField: nil, 41 | NumberValueField: wrapperspb.Int64(43), 42 | StringValueField: wrapperspb.String("string_value"), 43 | BoolValueField: wrapperspb.Bool(false), 44 | DurationValueField: durationpb.New(25401600000000000), 45 | Oneof: &pb.Test_Two{ 46 | Two: &pb.OneOfTwo{ 47 | StringField: "string_field", 48 | }, 49 | }, 50 | Descriptor_: &descriptorpb.DescriptorProto{}, 51 | TimeValueFieldWithDefault: ×tamppb.Timestamp{Seconds: -562032000}, 52 | Bytes: []byte("??"), 53 | } 54 | ) 55 | 56 | func TestDefaults(t *testing.T) { 57 | assert := assert2.New(t) 58 | require := require2.New(t) 59 | now := timestamppb.Now() 60 | 61 | test := &pb.Test{} 62 | test.Default() 63 | require.NotNil(test.TimeValueField) 64 | assert.InDelta(now.Seconds, test.TimeValueField.Seconds, 1) 65 | test.TimeValueField = nil 66 | assert.Equal(expect, test) 67 | 68 | _, generated := interface{}(&pb.OneOfOne{}).(interface{ Default() }) 69 | assert.False(generated) 70 | } 71 | 72 | func TestDefaultsReflect(t *testing.T) { 73 | assert := assert2.New(t) 74 | require := require2.New(t) 75 | now := timestamppb.Now() 76 | 77 | test := &pb.Test{} 78 | defaults.Apply(test) 79 | 80 | require.NotNil(test.TimeValueField) 81 | assert.InDelta(now.Seconds, test.TimeValueField.Seconds, 1) 82 | test.TimeValueField = nil 83 | assert.True(proto.Equal(expect, test)) 84 | 85 | _, generated := interface{}(&pb.OneOfOne{}).(interface{ Default() }) 86 | assert.False(generated) 87 | 88 | expect.StringField = "other" 89 | test = &pb.Test{StringField: "other"} 90 | defaults.Apply(test) 91 | require.NotNil(test.TimeValueField) 92 | assert.InDelta(now.Seconds, test.TimeValueField.Seconds, 1) 93 | test.TimeValueField = nil 94 | assert.True(proto.Equal(expect, test)) 95 | } 96 | 97 | func TestDefaultsReflectOptionals(t *testing.T) { 98 | assert := assert2.New(t) 99 | 100 | enum := pb.TestOptional_TWO 101 | expect := &pb.TestOptional{ 102 | StringField: proto.String("string_field"), 103 | NumberField: proto.Int64(42), 104 | BoolField: proto.Bool(true), 105 | EnumField: &enum, 106 | } 107 | 108 | test := &pb.TestOptional{} 109 | defaults.Apply(test) 110 | 111 | assert.True(proto.Equal(expect, test)) 112 | 113 | expect.StringField = proto.String("other") 114 | test = &pb.TestOptional{ 115 | StringField: proto.String("other"), 116 | } 117 | defaults.Apply(test) 118 | 119 | assert.True(proto.Equal(expect, test)) 120 | 121 | } 122 | -------------------------------------------------------------------------------- /tests/pb/test.pb.defaults.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-defaults. DO NOT EDIT. 16 | 17 | package pb 18 | 19 | import ( 20 | "google.golang.org/protobuf/types/descriptorpb" 21 | "google.golang.org/protobuf/types/known/durationpb" 22 | "google.golang.org/protobuf/types/known/timestamppb" 23 | "google.golang.org/protobuf/types/known/wrapperspb" 24 | ) 25 | 26 | var ( 27 | _ *timestamppb.Timestamp 28 | _ *durationpb.Duration 29 | _ *wrapperspb.BoolValue 30 | ) 31 | 32 | func (x *Test) Default() { 33 | if x.StringField == "" { 34 | x.StringField = "string_field" 35 | } 36 | if x.NumberField == 0 { 37 | x.NumberField = 42 38 | } 39 | if x.BoolField == false { 40 | x.BoolField = true 41 | } 42 | if x.EnumField == 0 { 43 | x.EnumField = 2 44 | } 45 | if v, ok := interface{}(x.MessageField).(interface{ Default() }); ok && x.MessageField != nil { 46 | v.Default() 47 | } 48 | if x.NumberValueField == nil { 49 | x.NumberValueField = &wrapperspb.Int64Value{Value: 43} 50 | } 51 | if x.StringValueField == nil { 52 | x.StringValueField = &wrapperspb.StringValue{Value: "string_value"} 53 | } 54 | if x.BoolValueField == nil { 55 | x.BoolValueField = &wrapperspb.BoolValue{Value: false} 56 | } 57 | if x.TimeValueField == nil { 58 | x.TimeValueField = timestamppb.Now() 59 | } 60 | if x.DurationValueField == nil { 61 | x.DurationValueField = durationpb.New(25401600000000000) 62 | } 63 | if x.Oneof == nil { 64 | x.Oneof = &Test_Two{} 65 | } 66 | switch x := x.Oneof.(type) { 67 | case *Test_One: 68 | if x.One == nil { 69 | x.One = &OneOfOne{} 70 | } 71 | if v, ok := interface{}(x.One).(interface{ Default() }); ok && x.One != nil { 72 | v.Default() 73 | } 74 | case *Test_Two: 75 | if x.Two == nil { 76 | x.Two = &OneOfTwo{} 77 | } 78 | if v, ok := interface{}(x.Two).(interface{ Default() }); ok && x.Two != nil { 79 | v.Default() 80 | } 81 | case *Test_Three: 82 | if x.Three == nil { 83 | x.Three = &OneOfThree{} 84 | } 85 | if v, ok := interface{}(x.Three).(interface{ Default() }); ok && x.Three != nil { 86 | v.Default() 87 | } 88 | case *Test_Four: 89 | if x.Four == 0 { 90 | x.Four = 1 91 | } 92 | } 93 | if x.Descriptor_ == nil { 94 | x.Descriptor_ = &descriptorpb.DescriptorProto{} 95 | } 96 | if v, ok := interface{}(x.Descriptor_).(interface{ Default() }); ok && x.Descriptor_ != nil { 97 | v.Default() 98 | } 99 | if x.TimeValueFieldWithDefault == nil { 100 | x.TimeValueFieldWithDefault = ×tamppb.Timestamp{Seconds: -562032000, Nanos: 0} 101 | 102 | } 103 | if len(x.Bytes) == 0 { 104 | x.Bytes = []byte("??") 105 | } 106 | } 107 | 108 | func (x *TestOptional) Default() { 109 | if x.StringField == nil { 110 | v := string("string_field") 111 | x.StringField = &v 112 | } 113 | if x.NumberField == nil { 114 | v := int64(42) 115 | x.NumberField = &v 116 | } 117 | if x.BoolField == nil { 118 | v := bool(true) 119 | x.BoolField = &v 120 | } 121 | if x.EnumField == nil { 122 | v := TestOptional_Type(2) 123 | x.EnumField = &v 124 | } 125 | } 126 | 127 | func (x *TestUnexported) _Default() { 128 | if x.StringField == nil { 129 | v := string("string_field") 130 | x.StringField = &v 131 | } 132 | if x.NumberField == nil { 133 | v := int64(42) 134 | x.NumberField = &v 135 | } 136 | if x.BoolField == nil { 137 | v := bool(true) 138 | x.BoolField = &v 139 | } 140 | if x.EnumField == nil { 141 | v := TestUnexported_Type(2) 142 | x.EnumField = &v 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /tests/pb/types.pb.defaults.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-defaults. DO NOT EDIT. 16 | 17 | package pb 18 | 19 | import ( 20 | "google.golang.org/protobuf/types/known/durationpb" 21 | "google.golang.org/protobuf/types/known/timestamppb" 22 | "google.golang.org/protobuf/types/known/wrapperspb" 23 | ) 24 | 25 | var ( 26 | _ *timestamppb.Timestamp 27 | _ *durationpb.Duration 28 | _ *wrapperspb.BoolValue 29 | ) 30 | 31 | func (x *Types) Default() { 32 | if x.Float == 0 { 33 | x.Float = 0.42 34 | } 35 | if x.Double == 0 { 36 | x.Double = 0.42 37 | } 38 | if x.Int32 == 0 { 39 | x.Int32 = 42 40 | } 41 | if x.Int64 == 0 { 42 | x.Int64 = 42 43 | } 44 | if x.Uint32 == 0 { 45 | x.Uint32 = 42 46 | } 47 | if x.Uint64 == 0 { 48 | x.Uint64 = 42 49 | } 50 | if x.Sint32 == 0 { 51 | x.Sint32 = 42 52 | } 53 | if x.Sint64 == 0 { 54 | x.Sint64 = 42 55 | } 56 | if x.Fixed32 == 0 { 57 | x.Fixed32 = 42 58 | } 59 | if x.Fixed64 == 0 { 60 | x.Fixed64 = 0 61 | } 62 | if x.Sfixed32 == 0 { 63 | x.Sfixed32 = 42 64 | } 65 | if x.Sfixed64 == 0 { 66 | x.Sfixed64 = 42 67 | } 68 | if x.Bool == false { 69 | x.Bool = true 70 | } 71 | if x.String_ == "" { 72 | x.String_ = "42" 73 | } 74 | if len(x.Bytes) == 0 { 75 | x.Bytes = []byte("42") 76 | } 77 | if x.Enum == 0 { 78 | x.Enum = 1 79 | } 80 | // Message: defaults disabled by [(defaults.value).message = {defaults: false}] 81 | if x.Oneof == nil { 82 | x.Oneof = &Types_Two{} 83 | } 84 | switch x := x.Oneof.(type) { 85 | case *Types_One: 86 | if x.One == nil { 87 | x.One = &OneOfOne{} 88 | } 89 | if v, ok := interface{}(x.One).(interface{ Default() }); ok && x.One != nil { 90 | v.Default() 91 | } 92 | case *Types_Two: 93 | if x.Two == nil { 94 | x.Two = &OneOfTwo{} 95 | } 96 | if v, ok := interface{}(x.Two).(interface{ Default() }); ok && x.Two != nil { 97 | v.Default() 98 | } 99 | case *Types_Three: 100 | if x.Three == nil { 101 | x.Three = &OneOfThree{} 102 | } 103 | if v, ok := interface{}(x.Three).(interface{ Default() }); ok && x.Three != nil { 104 | v.Default() 105 | } 106 | case *Types_Four: 107 | if x.Four == 0 { 108 | x.Four = 1 109 | } 110 | } 111 | if x.Duration == nil { 112 | x.Duration = durationpb.New(172800000000000) 113 | } 114 | if x.Timestamp == nil { 115 | x.Timestamp = timestamppb.Now() 116 | } 117 | if x.DoubleValue == nil { 118 | x.DoubleValue = &wrapperspb.DoubleValue{Value: 0.42} 119 | } 120 | if x.FloatValue == nil { 121 | x.FloatValue = &wrapperspb.FloatValue{Value: 0.42} 122 | } 123 | if x.Int64Value == nil { 124 | x.Int64Value = &wrapperspb.Int64Value{Value: 42} 125 | } 126 | if x.Uint64Value == nil { 127 | x.Uint64Value = &wrapperspb.UInt64Value{Value: 42} 128 | } 129 | if x.Int32Value == nil { 130 | x.Int32Value = &wrapperspb.Int32Value{Value: 42} 131 | } 132 | if x.Uint32Value == nil { 133 | x.Uint32Value = &wrapperspb.UInt32Value{Value: 42} 134 | } 135 | if x.BoolValue == nil { 136 | x.BoolValue = &wrapperspb.BoolValue{Value: false} 137 | } 138 | if x.StringValue == nil { 139 | x.StringValue = &wrapperspb.StringValue{Value: "42"} 140 | } 141 | if x.BytesValue == nil { 142 | x.BytesValue = &wrapperspb.BytesValue{Value: []byte("42")} 143 | } 144 | } 145 | 146 | func (x *Message) Default() { 147 | if x.Field == "" { 148 | x.Field = "lonely field" 149 | } 150 | } 151 | 152 | func (x *OneOfTwo) Default() { 153 | if x.StringField == "" { 154 | x.StringField = "string_field" 155 | } 156 | } 157 | 158 | func (x *OneOfThree) Default() { 159 | } 160 | -------------------------------------------------------------------------------- /module/module.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package module 16 | 17 | import ( 18 | "fmt" 19 | "strings" 20 | "text/template" 21 | 22 | pgs "github.com/lyft/protoc-gen-star" 23 | pgsgo "github.com/lyft/protoc-gen-star/lang/go" 24 | 25 | "go.linka.cloud/protoc-gen-defaults/defaults" 26 | ) 27 | 28 | func Defaults() *Module { 29 | return &Module{ 30 | ModuleBase: &pgs.ModuleBase{}, 31 | imports: make(map[string]struct{}), 32 | oneOfs: make(map[string]struct{}), 33 | } 34 | } 35 | 36 | type Module struct { 37 | *pgs.ModuleBase 38 | ctx pgsgo.Context 39 | tpl *template.Template 40 | imports map[string]struct{} 41 | oneOfs map[string]struct{} 42 | } 43 | 44 | func (m *Module) Name() string { 45 | return "defaults" 46 | } 47 | 48 | func (m *Module) InitContext(c pgs.BuildContext) { 49 | m.ModuleBase.InitContext(c) 50 | m.ctx = pgsgo.InitContext(c.Parameters()) 51 | 52 | tpl := template.New("fields").Funcs(map[string]interface{}{ 53 | "package": m.ctx.PackageName, 54 | "name": m.ctx.Name, 55 | "defaultMethod": func(m pgs.Message) string { 56 | var private bool 57 | m.Extension(defaults.E_Unexported, &private) 58 | if private { 59 | return "_Default" 60 | } 61 | return "Default" 62 | }, 63 | "comment": func(s string) string { 64 | var out string 65 | parts := strings.Split(s, "\n") 66 | for i, v := range parts { 67 | if i == len(parts)-1 && v == "" { 68 | return out 69 | } 70 | out += "//" + v + "\n" 71 | } 72 | return out 73 | }, 74 | "imports": func() string { 75 | var imports string 76 | for v := range m.imports { 77 | imports += fmt.Sprintf("\"%s\"\n", v) 78 | } 79 | return imports 80 | }, 81 | "gen": func(m pgs.Message) bool { 82 | var ignored bool 83 | ok, err := m.Extension(defaults.E_Ignored, &ignored) 84 | if err != nil || !ok { 85 | return true 86 | } 87 | return !ignored 88 | }, 89 | "enabled": func(m pgs.Message) bool { 90 | var disabled bool 91 | ok, err := m.Extension(defaults.E_Disabled, &disabled) 92 | if err != nil || !ok { 93 | return true 94 | } 95 | return !disabled 96 | }, 97 | "defaults": func(f pgs.Field) string { 98 | v, _ := m.genFieldDefaults(f) 99 | return v 100 | }, 101 | }) 102 | m.tpl = template.Must(tpl.Parse(defaultsTpl)) 103 | } 104 | 105 | func (m *Module) Execute(targets map[string]pgs.File, _ map[string]pgs.Package) []pgs.Artifact { 106 | for _, f := range targets { 107 | m.generate(f) 108 | } 109 | return m.Artifacts() 110 | } 111 | 112 | func (m *Module) generate(f pgs.File) { 113 | if len(f.Messages()) == 0 { 114 | return 115 | } 116 | for _, msg := range f.Messages() { 117 | m.Check(msg) 118 | } 119 | name := m.ctx.OutputPath(f).SetExt(".defaults.go") 120 | m.AddGeneratorTemplateFile(name.String(), m.tpl, f) 121 | } 122 | 123 | func (m *Module) isOneOfDone(oneOf pgs.OneOf) bool { 124 | _, done := m.oneOfs[oneOf.FullyQualifiedName()] 125 | return done 126 | } 127 | 128 | func (m *Module) setOneOfDone(oneOf pgs.OneOf) { 129 | if oneOf == nil { 130 | return 131 | } 132 | m.oneOfs[oneOf.FullyQualifiedName()] = struct{}{} 133 | } 134 | 135 | const defaultsTpl = `{{ comment .SyntaxSourceCodeInfo.LeadingComments }} 136 | {{ range .SyntaxSourceCodeInfo.LeadingDetachedComments }} 137 | {{ comment . }} 138 | {{ end }} 139 | // Code generated by protoc-gen-defaults. DO NOT EDIT. 140 | 141 | package {{ package . }} 142 | 143 | import ( 144 | "google.golang.org/protobuf/types/known/durationpb" 145 | "google.golang.org/protobuf/types/known/timestamppb" 146 | "google.golang.org/protobuf/types/known/wrapperspb" 147 | {{ imports }} 148 | ) 149 | 150 | var ( 151 | _ *timestamppb.Timestamp 152 | _ *durationpb.Duration 153 | _ *wrapperspb.BoolValue 154 | ) 155 | 156 | {{ range .AllMessages }} 157 | 158 | {{ if gen . }} 159 | func (x *{{ name . }}) {{ defaultMethod . }}() { 160 | {{- if enabled . }} 161 | {{- range .Fields }} 162 | {{- defaults . }} 163 | {{- end }} 164 | {{- end }} 165 | } 166 | {{- end }} 167 | {{ end }} 168 | ` 169 | -------------------------------------------------------------------------------- /.bingo/protoc-gen-debug.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 2 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 3 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= 4 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 5 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 6 | github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= 7 | github.com/lyft/protoc-gen-star v0.6.2 h1:DgqBrh0Q/JGHXDZjJaYCWKD/EXLczxplIC0JeElY2iU= 8 | github.com/lyft/protoc-gen-star v0.6.2/go.mod h1:M0b1EfeJR3f8E3YHKFr9KXWjAB4mrKn6Rm6PPEuJlI0= 9 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 10 | github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= 11 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 12 | github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= 13 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 14 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 15 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 16 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 17 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 18 | golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 19 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 20 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 21 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 22 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 23 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 24 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 25 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 26 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 27 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 28 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 29 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 30 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 31 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 32 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 33 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 34 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 35 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 36 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 37 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 38 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 39 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 40 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 41 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 42 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 43 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 44 | google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= 45 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 46 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 47 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 48 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 49 | -------------------------------------------------------------------------------- /module/defaults.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package module 16 | 17 | import ( 18 | "errors" 19 | "fmt" 20 | "strings" 21 | "time" 22 | 23 | pgs "github.com/lyft/protoc-gen-star" 24 | "github.com/prometheus/common/model" 25 | 26 | "go.linka.cloud/protoc-gen-defaults/defaults" 27 | ) 28 | 29 | func (m *Module) genFieldDefaults(f pgs.Field, genOneOfField ...bool) (string, bool) { 30 | m.Push(f.Name().String()) 31 | defer m.Pop() 32 | var fieldDefaults defaults.FieldDefaults 33 | ok, err := f.Extension(defaults.E_Value, &fieldDefaults) 34 | if err != nil || !ok { 35 | return "", false 36 | } 37 | wk := pgs.UnknownWKT 38 | if emb := f.Type().Embed(); emb != nil { 39 | wk = emb.WellKnownType() 40 | } 41 | if !isOk(genOneOfField) && f.InRealOneOf() { 42 | if m.isOneOfDone(f.OneOf()) { 43 | return "", false 44 | } 45 | m.setOneOfDone(f.OneOf()) 46 | var out string 47 | var oneOfDefault string 48 | if _, err := f.OneOf().Extension(defaults.E_Oneof, &oneOfDefault); err != nil { 49 | m.Fail(err) 50 | } 51 | var defaultField pgs.Field 52 | for _, f := range f.OneOf().Fields() { 53 | if f.Name().String() == oneOfDefault { 54 | defaultField = f 55 | } 56 | } 57 | if defaultField != nil { 58 | out += fmt.Sprint(` 59 | if x.`, m.ctx.Name(f.OneOf()), ` == nil { 60 | x.`, m.ctx.Name(f.OneOf()), ` = &`, m.ctx.OneofOption(defaultField), `{} 61 | }`) 62 | } 63 | out += fmt.Sprint(` 64 | switch x := x.`, m.ctx.Name(f.OneOf()), `.(type) {`) 65 | for _, f := range f.OneOf().Fields() { 66 | def, ok := m.genFieldDefaults(f, true) 67 | if !ok { 68 | continue 69 | } 70 | out += fmt.Sprint(` 71 | case *`, m.ctx.OneofOption(f), `: `, def) 72 | } 73 | out += `}` 74 | return out, true 75 | } 76 | name := m.ctx.Name(f) 77 | switch r := fieldDefaults.Type.(type) { 78 | case *defaults.FieldDefaults_Float: 79 | return m.simpleDefaults(f, 0, fieldDefaults.GetFloat(), wk), true 80 | case *defaults.FieldDefaults_Double: 81 | return m.simpleDefaults(f, 0, fieldDefaults.GetDouble(), wk), true 82 | case *defaults.FieldDefaults_Int32: 83 | return m.simpleDefaults(f, 0, fieldDefaults.GetInt32(), wk), true 84 | case *defaults.FieldDefaults_Int64: 85 | return m.simpleDefaults(f, 0, fieldDefaults.GetInt64(), wk), true 86 | case *defaults.FieldDefaults_Uint32: 87 | return m.simpleDefaults(f, 0, fieldDefaults.GetUint32(), wk), true 88 | case *defaults.FieldDefaults_Uint64: 89 | return m.simpleDefaults(f, 0, fieldDefaults.GetUint64(), wk), true 90 | case *defaults.FieldDefaults_Sint32: 91 | return m.simpleDefaults(f, 0, fieldDefaults.GetSint32(), wk), true 92 | case *defaults.FieldDefaults_Sint64: 93 | return m.simpleDefaults(f, 0, fieldDefaults.GetSint64(), wk), true 94 | case *defaults.FieldDefaults_Fixed32: 95 | return m.simpleDefaults(f, 0, fieldDefaults.GetFixed32(), wk), true 96 | case *defaults.FieldDefaults_Fixed64: 97 | return m.simpleDefaults(f, 0, fieldDefaults.GetFixed32(), wk), true 98 | case *defaults.FieldDefaults_Sfixed32: 99 | return m.simpleDefaults(f, 0, fieldDefaults.GetSfixed32(), wk), true 100 | case *defaults.FieldDefaults_Sfixed64: 101 | return m.simpleDefaults(f, 0, fieldDefaults.GetSfixed64(), wk), true 102 | case *defaults.FieldDefaults_Bool: 103 | return m.simpleDefaults(f, false, fieldDefaults.GetBool(), wk), true 104 | case *defaults.FieldDefaults_String_: 105 | return m.simpleDefaults(f, `""`, fmt.Sprint(`"`, fieldDefaults.GetString_(), `"`), wk), true 106 | case *defaults.FieldDefaults_Bytes: 107 | if wk == pgs.UnknownWKT { 108 | return fmt.Sprint(` 109 | if len(x.`, name, `) == 0 { 110 | x.`, name, ` = []byte("`, string(fieldDefaults.GetBytes()), `") 111 | }`), true 112 | } 113 | return fmt.Sprint(` 114 | if x.`, name, ` == nil { 115 | x.`, name, ` = &wrapperspb.BytesValue{Value: []byte("`, string(fieldDefaults.GetBytes()), `")} 116 | }`), true 117 | case *defaults.FieldDefaults_Enum: 118 | return m.simpleDefaults(f, 0, fieldDefaults.GetEnum(), wk), true 119 | case *defaults.FieldDefaults_Duration: 120 | d, err := model.ParseDuration(fieldDefaults.GetDuration()) 121 | if err != nil { 122 | m.Failf("invalid duration: %s %v", fieldDefaults.GetDuration(), err) 123 | } 124 | return m.simpleDefaults(f, `nil`, fmt.Sprint(`durationpb.New(`, int64(d), `)`), pgs.UnknownWKT), true 125 | case *defaults.FieldDefaults_Timestamp: 126 | v := strings.TrimSpace(fieldDefaults.GetTimestamp()) 127 | if strings.ToLower(v) == "now" { 128 | return m.simpleDefaults(f, `nil`, `timestamppb.Now()`, pgs.UnknownWKT), true 129 | } 130 | t, err := parseTime(v) 131 | if err != nil { 132 | m.Failf("invalid timestamp: %s %v", fieldDefaults.GetTimestamp(), err) 133 | } 134 | v = fmt.Sprint(`×tamppb.Timestamp{Seconds: `, t.Unix(), `, Nanos: `, t.Nanosecond(), `} 135 | `) 136 | return m.simpleDefaults(f, `nil`, v, pgs.UnknownWKT), true 137 | case *defaults.FieldDefaults_Message: 138 | if fieldDefaults.GetMessage() != nil && fieldDefaults.GetMessage().Defaults != nil && !fieldDefaults.GetMessage().GetDefaults() { 139 | return fmt.Sprint("\n// ", name, ": defaults disabled by [(defaults.value).message = {defaults: false}]"), true 140 | } 141 | var decl string 142 | if fieldDefaults.GetMessage().GetInitialize() { 143 | decl = fmt.Sprint(` 144 | if x.`, name, ` == nil { 145 | x.`, name, ` = &`, m.ctx.Type(f).Value(), `{} 146 | }`) 147 | } 148 | return decl + fmt.Sprint(` 149 | if v, ok := interface{}(x.`, name, `).(interface{Default()}); ok && x.`, name, ` != nil { 150 | v.Default() 151 | }`), true 152 | case nil: // noop 153 | default: 154 | _ = r 155 | m.Failf("unknown rule type (%T)", fieldDefaults.Type) 156 | } 157 | return fmt.Sprint("\n// ", f.Name()), true 158 | } 159 | 160 | func (m *Module) simpleDefaults(f pgs.Field, zero, value interface{}, wk pgs.WellKnownType) string { 161 | name := m.ctx.Name(f).String() 162 | if wk != "" && wk != pgs.UnknownWKT { 163 | return fmt.Sprint(` 164 | if x.`, name, ` == nil { 165 | x.`, name, ` = &wrapperspb.`, wk, `{Value: `, value, `} 166 | }`) 167 | } 168 | if f.HasOptionalKeyword() { 169 | zero = "nil" 170 | return fmt.Sprint(` 171 | if x.`, name, ` == `, zero, ` { 172 | v := `, m.ctx.Type(f).Value(), `(`, value, `) 173 | x.`, name, ` = &v 174 | }`) 175 | } 176 | return fmt.Sprint(` 177 | if x.`, name, ` == `, zero, ` { 178 | x.`, name, ` = `, value, ` 179 | }`) 180 | } 181 | 182 | func parseTime(s string) (time.Time, error) { 183 | for _, format := range []string{ 184 | time.RFC822, 185 | time.RFC822Z, 186 | time.RFC850, 187 | time.RFC1123, 188 | time.RFC1123Z, 189 | time.RFC3339, 190 | } { 191 | t, err := time.Parse(format, s) 192 | if err == nil { 193 | return t, nil 194 | } 195 | } 196 | return time.Time{}, errors.New("cannot parse timestamp, timestamp supported format: RFC822 / RFC822Z / RFC850 / RFC1123 / RFC1123Z / RFC3339") 197 | } 198 | 199 | func isOk(b []bool) bool { 200 | return len(b) > 0 && b[0] 201 | } 202 | -------------------------------------------------------------------------------- /module/checker.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package module 16 | 17 | import ( 18 | "strings" 19 | 20 | pgs "github.com/lyft/protoc-gen-star" 21 | "github.com/prometheus/common/model" 22 | "google.golang.org/protobuf/proto" 23 | "google.golang.org/protobuf/types/known/timestamppb" 24 | 25 | "go.linka.cloud/protoc-gen-defaults/defaults" 26 | ) 27 | 28 | // Heavily taken from https://github.com/envoyproxy/protoc-gen-validate/blob/main/module/checker.go 29 | 30 | type FieldType interface { 31 | ProtoType() pgs.ProtoType 32 | Embed() pgs.Message 33 | } 34 | 35 | type Repeatable interface { 36 | IsRepeated() bool 37 | } 38 | 39 | func (m *Module) Check(msg pgs.Message) { 40 | m.Push("msg: " + msg.Name().String()) 41 | defer m.Pop() 42 | 43 | var disabled bool 44 | _, err := msg.Extension(defaults.E_Disabled, &disabled) 45 | m.CheckErr(err, "unable to read defaults extension from message") 46 | 47 | if disabled { 48 | m.Debug("defaults disabled, skipping checks") 49 | return 50 | } 51 | 52 | for _, f := range msg.Fields() { 53 | m.Push(f.Name().String()) 54 | 55 | var fieldDefaults defaults.FieldDefaults 56 | _, err = f.Extension(defaults.E_Value, &fieldDefaults) 57 | m.CheckErr(err, "unable to read defaults from field") 58 | 59 | if fieldDefaults.GetMessage() != nil { 60 | m.MustType(f.Type(), pgs.MessageT, pgs.UnknownWKT) 61 | m.CheckMessage(f, &fieldDefaults) 62 | } 63 | 64 | m.CheckFieldRules(f.Type(), &fieldDefaults) 65 | 66 | if f.InRealOneOf() { 67 | m.CheckOneOf(f.OneOf()) 68 | } 69 | m.Pop() 70 | } 71 | } 72 | 73 | func (m *Module) CheckOneOf(oneOf pgs.OneOf) { 74 | var oneOfDefaults string 75 | ok, err := oneOf.Extension(defaults.E_Oneof, &oneOfDefaults) 76 | m.CheckErr(err, "unable to read defaults extension from oneof") 77 | if !ok { 78 | return 79 | } 80 | for _, field := range oneOf.Fields() { 81 | if field.Name().String() == oneOfDefaults { 82 | return 83 | } 84 | } 85 | m.Failf("oneof field '%s' not found in %s", oneOfDefaults, oneOf.Name().String()) 86 | } 87 | 88 | func (m *Module) CheckFieldRules(typ FieldType, fieldDefaults *defaults.FieldDefaults) { 89 | if fieldDefaults == nil { 90 | return 91 | } 92 | 93 | switch r := fieldDefaults.Type.(type) { 94 | case *defaults.FieldDefaults_Float: 95 | m.MustType(typ, pgs.FloatT, pgs.FloatValueWKT) 96 | case *defaults.FieldDefaults_Double: 97 | m.MustType(typ, pgs.DoubleT, pgs.DoubleValueWKT) 98 | case *defaults.FieldDefaults_Int32: 99 | m.MustType(typ, pgs.Int32T, pgs.Int32ValueWKT) 100 | case *defaults.FieldDefaults_Int64: 101 | m.MustType(typ, pgs.Int64T, pgs.Int64ValueWKT) 102 | case *defaults.FieldDefaults_Uint32: 103 | m.MustType(typ, pgs.UInt32T, pgs.UInt32ValueWKT) 104 | case *defaults.FieldDefaults_Uint64: 105 | m.MustType(typ, pgs.UInt64T, pgs.UInt64ValueWKT) 106 | case *defaults.FieldDefaults_Sint32: 107 | m.MustType(typ, pgs.SInt32, pgs.UnknownWKT) 108 | case *defaults.FieldDefaults_Sint64: 109 | m.MustType(typ, pgs.SInt64, pgs.UnknownWKT) 110 | case *defaults.FieldDefaults_Fixed32: 111 | m.MustType(typ, pgs.Fixed32T, pgs.UnknownWKT) 112 | case *defaults.FieldDefaults_Fixed64: 113 | m.MustType(typ, pgs.Fixed64T, pgs.UnknownWKT) 114 | case *defaults.FieldDefaults_Sfixed32: 115 | m.MustType(typ, pgs.SFixed32, pgs.UnknownWKT) 116 | case *defaults.FieldDefaults_Sfixed64: 117 | m.MustType(typ, pgs.SFixed64, pgs.UnknownWKT) 118 | case *defaults.FieldDefaults_Bool: 119 | m.MustType(typ, pgs.BoolT, pgs.BoolValueWKT) 120 | case *defaults.FieldDefaults_String_: 121 | m.MustType(typ, pgs.StringT, pgs.StringValueWKT) 122 | case *defaults.FieldDefaults_Bytes: 123 | m.MustType(typ, pgs.BytesT, pgs.BytesValueWKT) 124 | case *defaults.FieldDefaults_Enum: 125 | m.MustType(typ, pgs.EnumT, pgs.UnknownWKT) 126 | m.CheckEnum(typ, r.Enum) 127 | case *defaults.FieldDefaults_Duration: 128 | m.CheckDuration(typ, r.Duration) 129 | case *defaults.FieldDefaults_Timestamp: 130 | m.CheckTimestamp(typ, r.Timestamp) 131 | case *defaults.FieldDefaults_Message: 132 | m.MustType(typ, pgs.MessageT, pgs.UnknownWKT) 133 | case nil: // noop 134 | default: 135 | m.Failf("unknown rule type (%T)", fieldDefaults.Type) 136 | } 137 | } 138 | 139 | func (m *Module) MustType(typ FieldType, pt pgs.ProtoType, wrapper pgs.WellKnownType) { 140 | if emb := typ.Embed(); emb != nil && emb.IsWellKnown() && emb.WellKnownType() == wrapper { 141 | m.MustType(emb.Fields()[0].Type(), pt, pgs.UnknownWKT) 142 | return 143 | } 144 | if typ, ok := typ.(Repeatable); ok { 145 | m.Assert(!typ.IsRepeated(), 146 | "repeated default should be used for repeated fields") 147 | } 148 | 149 | m.Assert(typ.ProtoType() == pt, 150 | " expected defaults for ", 151 | typ.ProtoType().Proto(), 152 | " but got ", 153 | pt.Proto(), 154 | ) 155 | } 156 | 157 | func (m *Module) CheckEnum(ft FieldType, r uint32) { 158 | typ, ok := ft.(interface { 159 | Enum() pgs.Enum 160 | }) 161 | 162 | if !ok { 163 | m.Failf("unexpected field type (%T)", ft) 164 | } 165 | 166 | defined := typ.Enum().Values() 167 | 168 | for _, val := range defined { 169 | if val.Value() == int32(r) { 170 | return 171 | } 172 | } 173 | m.Failf("unexpected enum value %d for %s", r, typ.Enum().Name()) 174 | } 175 | 176 | func (m *Module) CheckMessage(f pgs.Field, defaults *defaults.FieldDefaults) { 177 | m.Assert(f.Type().IsEmbed(), "field is not embedded but got message defaults") 178 | emb := f.Type().Embed() 179 | if emb != nil && emb.IsWellKnown() { 180 | switch emb.WellKnownType() { 181 | case pgs.AnyWKT: 182 | m.Failf("Any value should be used for Any fields") 183 | case pgs.DurationWKT: 184 | m.Failf("Duration value should be used for Duration fields") 185 | case pgs.TimestampWKT: 186 | m.Failf("Timestamp value should be used for Timestamp fields") 187 | } 188 | } 189 | if !defaults.GetMessage().GetInitialize() { 190 | return 191 | } 192 | current := m.ctx.ImportPath(f.Message()).String() 193 | if i := m.ctx.ImportPath(f.Type().Embed()).String(); i != current { 194 | m.imports[i] = struct{}{} 195 | } 196 | } 197 | 198 | func (m *Module) CheckDuration(ft FieldType, r string) { 199 | if embed := ft.Embed(); embed == nil || embed.WellKnownType() != pgs.DurationWKT { 200 | m.Failf("unexpected field type (%T) for Duration, expected google.protobuf.Duration ", ft) 201 | } 202 | _, err := model.ParseDuration(r) 203 | m.Assert(err == nil, "cannot parse duration ", r, err) 204 | } 205 | 206 | func (m *Module) CheckTimestamp(ft FieldType, r string) { 207 | if embed := ft.Embed(); embed == nil || embed.WellKnownType() != pgs.TimestampWKT { 208 | m.Failf("unexpected field type (%T) for Timestamp, expected google.protobuf.Timestamp ", ft) 209 | } 210 | v := strings.TrimSpace(r) 211 | if strings.ToLower(v) == "now" { 212 | return 213 | } 214 | _, err := parseTime(r) 215 | m.Assert(err == nil, r, ": ", err) 216 | } 217 | 218 | func (m *Module) mustFieldType(ft FieldType) pgs.FieldType { 219 | typ, ok := ft.(pgs.FieldType) 220 | if !ok { 221 | m.Failf("unexpected field type (%T)", ft) 222 | } 223 | 224 | return typ 225 | } 226 | 227 | func (m *Module) checkTS(ts *timestamppb.Timestamp) *int64 { 228 | if ts == nil { 229 | return nil 230 | } 231 | 232 | t, err := ts.AsTime(), ts.CheckValid() 233 | m.CheckErr(err, "could not resolve timestamp") 234 | return proto.Int64(t.UnixNano()) 235 | } 236 | -------------------------------------------------------------------------------- /defaults/defaults.extensions.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package defaults 16 | 17 | import ( 18 | "errors" 19 | "strings" 20 | "time" 21 | 22 | "github.com/prometheus/common/model" 23 | "google.golang.org/protobuf/proto" 24 | reflect "google.golang.org/protobuf/reflect/protoreflect" 25 | "google.golang.org/protobuf/types/known/durationpb" 26 | "google.golang.org/protobuf/types/known/timestamppb" 27 | "google.golang.org/protobuf/types/known/wrapperspb" 28 | ) 29 | 30 | func Apply(m proto.Message) { 31 | if m == nil { 32 | return 33 | } 34 | mref := m.ProtoReflect() 35 | typd := mref.Type().Descriptor() 36 | opts := typd.Options() 37 | disabled := proto.GetExtension(opts, E_Disabled) 38 | if disabled.(bool) { 39 | return 40 | } 41 | ignored := proto.GetExtension(opts, E_Ignored) 42 | if ignored.(bool) { 43 | return 44 | } 45 | fields := typd.Fields() 46 | for i := 0; i < fields.Len(); i++ { 47 | f := fields.Get(i) 48 | if f.IsList() || f.IsMap() { 49 | continue 50 | } 51 | if mref.Has(f) { 52 | continue 53 | } 54 | v := proto.GetExtension(f.Options(), E_Value) 55 | if v == nil { 56 | continue 57 | } 58 | fd, ok := v.(*FieldDefaults) 59 | if !ok { 60 | // wtf ??? 61 | continue 62 | } 63 | name := f.Name() 64 | if oo := f.ContainingOneof(); oo != nil && !oo.IsSynthetic() { 65 | v := proto.GetExtension(oo.Options(), E_Oneof) 66 | oon, ok := v.(string) 67 | if !ok { 68 | // wtf ?? 69 | continue 70 | } 71 | if oon != string(name) { 72 | continue 73 | } 74 | } 75 | switch f.Kind() { 76 | case reflect.BoolKind: 77 | if _, ok := fd.GetType().(*FieldDefaults_Bool); !ok { 78 | continue 79 | } 80 | mref.Set(f, reflect.ValueOf(fd.GetBool())) 81 | case reflect.EnumKind: 82 | if _, ok := fd.GetType().(*FieldDefaults_Enum); !ok { 83 | continue 84 | } 85 | mref.Set(f, reflect.ValueOf(reflect.EnumNumber(fd.GetEnum()))) 86 | case reflect.Int32Kind: 87 | if _, ok := fd.GetType().(*FieldDefaults_Int32); !ok { 88 | continue 89 | } 90 | mref.Set(f, reflect.ValueOf(fd.GetInt32())) 91 | case reflect.Sint32Kind: 92 | if _, ok := fd.GetType().(*FieldDefaults_Sint32); !ok { 93 | continue 94 | } 95 | mref.Set(f, reflect.ValueOf(fd.GetSint32())) 96 | case reflect.Uint32Kind: 97 | if _, ok := fd.GetType().(*FieldDefaults_Uint32); !ok { 98 | continue 99 | } 100 | mref.Set(f, reflect.ValueOf(fd.GetUint32())) 101 | case reflect.Int64Kind: 102 | if _, ok := fd.GetType().(*FieldDefaults_Int64); !ok { 103 | continue 104 | } 105 | mref.Set(f, reflect.ValueOf(fd.GetInt64())) 106 | case reflect.Sint64Kind: 107 | if _, ok := fd.GetType().(*FieldDefaults_Sint64); !ok { 108 | continue 109 | } 110 | mref.Set(f, reflect.ValueOf(fd.GetSint64())) 111 | case reflect.Uint64Kind: 112 | if _, ok := fd.GetType().(*FieldDefaults_Uint64); !ok { 113 | continue 114 | } 115 | mref.Set(f, reflect.ValueOf(fd.GetUint64())) 116 | case reflect.Sfixed32Kind: 117 | if _, ok := fd.GetType().(*FieldDefaults_Sfixed32); !ok { 118 | continue 119 | } 120 | mref.Set(f, reflect.ValueOf(fd.GetSfixed32())) 121 | case reflect.Fixed32Kind: 122 | if _, ok := fd.GetType().(*FieldDefaults_Fixed32); !ok { 123 | continue 124 | } 125 | mref.Set(f, reflect.ValueOf(fd.GetFixed32())) 126 | case reflect.FloatKind: 127 | if _, ok := fd.GetType().(*FieldDefaults_Float); !ok { 128 | continue 129 | } 130 | mref.Set(f, reflect.ValueOf(fd.GetFloat())) 131 | case reflect.Sfixed64Kind: 132 | if _, ok := fd.GetType().(*FieldDefaults_Sfixed64); !ok { 133 | continue 134 | } 135 | mref.Set(f, reflect.ValueOf(fd.GetSfixed64())) 136 | case reflect.Fixed64Kind: 137 | if _, ok := fd.GetType().(*FieldDefaults_Fixed64); !ok { 138 | continue 139 | } 140 | mref.Set(f, reflect.ValueOf(fd.GetFixed64())) 141 | case reflect.DoubleKind: 142 | if _, ok := fd.GetType().(*FieldDefaults_Double); !ok { 143 | continue 144 | } 145 | mref.Set(f, reflect.ValueOf(fd.GetDouble())) 146 | case reflect.StringKind: 147 | if _, ok := fd.GetType().(*FieldDefaults_String_); !ok { 148 | continue 149 | } 150 | mref.Set(f, reflect.ValueOf(fd.GetString_())) 151 | case reflect.BytesKind: 152 | if _, ok := fd.GetType().(*FieldDefaults_Bytes); !ok { 153 | continue 154 | } 155 | mref.Set(f, reflect.ValueOf(fd.GetBytes())) 156 | case reflect.MessageKind: 157 | m := fd.GetMessage() 158 | switch mref.Get(f).Message().Interface().(type) { 159 | case *durationpb.Duration: 160 | if _, ok := fd.GetType().(*FieldDefaults_Duration); !ok { 161 | continue 162 | } 163 | if d, err := model.ParseDuration(fd.GetDuration()); err == nil { 164 | mref.Set(f, reflect.ValueOf(durationpb.New(time.Duration(d)).ProtoReflect())) 165 | } 166 | case *timestamppb.Timestamp: 167 | if _, ok := fd.GetType().(*FieldDefaults_Timestamp); !ok { 168 | continue 169 | } 170 | ts := fd.GetTimestamp() 171 | if strings.ToLower(ts) == "now" { 172 | mref.Set(f, reflect.ValueOf(timestamppb.Now().ProtoReflect())) 173 | continue 174 | } 175 | if t, err := parseTime(ts); err == nil { 176 | mref.Set(f, reflect.ValueOf(timestamppb.New(t).ProtoReflect())) 177 | } 178 | case *wrapperspb.DoubleValue: 179 | if _, ok := fd.GetType().(*FieldDefaults_Double); !ok { 180 | continue 181 | } 182 | mref.Set(f, reflect.ValueOf(wrapperspb.Double(fd.GetDouble()).ProtoReflect())) 183 | case *wrapperspb.FloatValue: 184 | if _, ok := fd.GetType().(*FieldDefaults_Float); !ok { 185 | continue 186 | } 187 | mref.Set(f, reflect.ValueOf(wrapperspb.Float(fd.GetFloat()).ProtoReflect())) 188 | case *wrapperspb.Int64Value: 189 | if _, ok := fd.GetType().(*FieldDefaults_Int64); !ok { 190 | continue 191 | } 192 | mref.Set(f, reflect.ValueOf(wrapperspb.Int64(fd.GetInt64()).ProtoReflect())) 193 | case *wrapperspb.UInt64Value: 194 | if _, ok := fd.GetType().(*FieldDefaults_Uint64); !ok { 195 | continue 196 | } 197 | mref.Set(f, reflect.ValueOf(wrapperspb.UInt64(fd.GetUint64()).ProtoReflect())) 198 | case *wrapperspb.Int32Value: 199 | if _, ok := fd.GetType().(*FieldDefaults_Int32); !ok { 200 | continue 201 | } 202 | mref.Set(f, reflect.ValueOf(wrapperspb.Int32(fd.GetInt32()).ProtoReflect())) 203 | case *wrapperspb.UInt32Value: 204 | if _, ok := fd.GetType().(*FieldDefaults_Uint32); !ok { 205 | continue 206 | } 207 | mref.Set(f, reflect.ValueOf(wrapperspb.UInt32(fd.GetUint32()).ProtoReflect())) 208 | case *wrapperspb.BoolValue: 209 | if _, ok := fd.GetType().(*FieldDefaults_Bool); !ok { 210 | continue 211 | } 212 | mref.Set(f, reflect.ValueOf(wrapperspb.Bool(fd.GetBool()).ProtoReflect())) 213 | case *wrapperspb.StringValue: 214 | if _, ok := fd.GetType().(*FieldDefaults_String_); !ok { 215 | continue 216 | } 217 | mref.Set(f, reflect.ValueOf(wrapperspb.String(fd.GetString_()).ProtoReflect())) 218 | case *wrapperspb.BytesValue: 219 | if _, ok := fd.GetType().(*FieldDefaults_Bytes); !ok { 220 | continue 221 | } 222 | mref.Set(f, reflect.ValueOf(wrapperspb.Bytes(fd.GetBytes()).ProtoReflect())) 223 | default: 224 | if _, ok := fd.GetType().(*FieldDefaults_Message); !ok { 225 | continue 226 | } 227 | if !mref.Get(f).Message().IsValid() { 228 | if !m.GetInitialize() { 229 | continue 230 | } 231 | mref.Set(f, reflect.ValueOf(mref.Get(f).Message().New())) 232 | } 233 | if !m.GetDefaults() { 234 | continue 235 | } 236 | Apply(mref.Get(f).Message().Interface()) 237 | } 238 | case reflect.GroupKind: 239 | } 240 | } 241 | } 242 | 243 | func parseTime(s string) (time.Time, error) { 244 | for _, format := range []string{ 245 | time.RFC822, 246 | time.RFC822Z, 247 | time.RFC850, 248 | time.RFC1123, 249 | time.RFC1123Z, 250 | time.RFC3339, 251 | } { 252 | t, err := time.Parse(format, s) 253 | if err == nil { 254 | return t, nil 255 | } 256 | } 257 | return time.Time{}, errors.New("cannot parse timestamp, timestamp supported format: RFC822 / RFC822Z / RFC850 / RFC1123 / RFC1123Z / RFC3339") 258 | } 259 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # protoc-gen-defaults 2 | 3 | *This project is currently in **alpha**. The API should be considered unstable and likely to change* 4 | 5 | **protoc-gen-defaults** is a protoc plugin generating the implementation of a `Defaulter` 6 | interface on messages: 7 | ```go 8 | type Defaulter interface { 9 | Default() 10 | } 11 | ``` 12 | 13 | ## Installation 14 | 15 | ```bash 16 | go get go.linka.cloud/protoc-gen-defaults 17 | ``` 18 | 19 | ## Usage 20 | 21 | ### Overview 22 | 23 | **protoc-gen-defaults** make use of **Protobuf** options to define defaults field value. 24 | 25 | ### Generation 26 | 27 | **protoc-gen-defaults** works the same way does the **protoc** plugins 28 | 29 | Example: 30 | ```bash 31 | protoc -I. -I defaults --go_out=paths=source_relative:. --defaults_out=paths=source_relative:. types.proto 32 | ``` 33 | 34 | ### Disable generation or implementation 35 | 36 | Implementation generation can be ignored with the `(defaults.ignored) = true` message option. 37 | 38 | ```proto 39 | message NoDefaulterImplementation { 40 | option (defaults.ignored) = true; 41 | string string_field = 1 [(defaults.value).string = "string_field"]; 42 | } 43 | ``` 44 | > It may be useful if you intend to write your own `Defaulter` implementation. 45 | 46 | 47 | An empty implementation can be generated with the `(defaults.disabled) = true` message option 48 | 49 | ```proto 50 | message EmptyDefaulterImplementation { 51 | option (defaults.disabled) = true; 52 | string string_field = 1 [(defaults.value).string = "string_field"]; 53 | } 54 | ``` 55 | 56 | ### Scalar and Well-Known Value 57 | 58 | Each scalar or Well-Known type has its corresponding `(defaults.value).[scalar] = [value]` option, 59 | the `[value]` will be set if the scalar field has the **zero value**, e.g `0` for numbers, 60 | `""` for strings, `false` for bools 61 | 62 | - **float / google.protobuf.FloatValue**: 63 | ```proto 64 | float float = 1 [(defaults.value).float = 0.42]; 65 | ``` 66 | - **double / google.protobuf.DoubleValue**: 67 | ```proto 68 | double double = 2 [(defaults.value).double = 0.42]; 69 | ****google.protobuf.DoubleValue double_value = 20 [(defaults.value).double = 0.42]; 70 | ``` 71 | - **int32 / google.protobuf.Int32Value**: 72 | ```proto 73 | int32 int32 = 3 [(defaults.value).int32 = 42]; 74 | google.protobuf.Int32Value int32_value = 24 [(defaults.value).int32 = 42]; 75 | ``` 76 | - **int64 / google.protobuf.Int64Value**: 77 | ```proto 78 | int64 int64 = 4 [(defaults.value).int64 = 42]; 79 | google.protobuf.Int64Value int64_value = 22 [(defaults.value).int64 = 42]; 80 | ``` 81 | - **uint32 / google.protobuf.UInt32Value**: 82 | ```proto 83 | uint32 uint32 = 5 [(defaults.value).uint32 = 42]; 84 | google.protobuf.UInt32Value uint32_value = 25 [(defaults.value).uint32 = 42]; 85 | ``` 86 | - **uint64 / google.protobuf.UInt64Value**: 87 | ```proto 88 | uint64 uint64 = 6 [(defaults.value).uint64 = 42]; 89 | google.protobuf.UInt64Value uint64_value = 23 [(defaults.value).uint64 = 42]; 90 | ``` 91 | - **sint32**: 92 | ```proto 93 | sint32 sint32 = 7 [(defaults.value).sint32 = 42]; 94 | ``` 95 | - **sint64**: 96 | ```proto 97 | sint64 sint64 = 8 [(defaults.value).sint64 = 42]; 98 | ``` 99 | - **fixed32**: 100 | ```proto 101 | fixed32 fixed32 = 9 [(defaults.value).fixed32 = 42]; 102 | ``` 103 | - **fixed64**: 104 | ```proto 105 | fixed64 fixed64 = 10 [(defaults.value).fixed64 = 42]; 106 | ``` 107 | - **sfixed32**: 108 | ```proto 109 | sfixed32 sfixed32 = 11 [(defaults.value).sfixed32 = 42]; 110 | ``` 111 | - **sfixed64**: 112 | ```proto 113 | sfixed64 sfixed64 = 12 [(defaults.value).sfixed64 = 42]; 114 | ``` 115 | - **bool / google.protobuf.BoolValue**: 116 | ```proto 117 | bool bool = 13 [(defaults.value).bool = true]; 118 | google.protobuf.BoolValue bool_value = 26 [(defaults.value).bool = false]; 119 | ``` 120 | - **string / google.protobuf.StringValue**: 121 | ```proto 122 | string string = 14 [(defaults.value).string = "42"]; 123 | google.protobuf.StringValue string_value = 27 [(defaults.value).string = "42"]; 124 | ``` 125 | - **bytes / google.protobuf.BytesValue**: 126 | ```proto 127 | bytes bytes = 15 [(defaults.value).bytes = "42"]; 128 | google.protobuf.BytesValue bytes_value = 28 [(defaults.value).bytes = "42"]; 129 | ``` 130 | 131 | ### Messages 132 | 133 | Message default behaviour is defined with the `(defaults.value).message = {initialize: bool, defaults: bool}` field option. 134 | 135 | - `initialize`: if set to `true` the field will be initialized with an empty `stuct reference` from the appropriate type 136 | - `defaults`: tells that the `Default` method should be called if the type implements the `Defaulter` interface 137 | 138 | ```proto 139 | Message message = 17 [(defaults.value).message = {initialize: true, defaults: true}]; 140 | ``` 141 | 142 | ### Well-Known Messages 143 | 144 | **google.protobuf.Duration** 145 | 146 | The default value is parsed according to the [Prometheus time durations format](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-durations) 147 | ```proto 148 | google.protobuf.Duration duration = 18 [(defaults.value).duration = "2d"]; 149 | ``` 150 | 151 | **google.protobuf.Timestamp** 152 | 153 | The default value is parsed using the following RFCs as defined in the `time` package: 154 | - time.RFC822 155 | - time.RFC822Z 156 | - time.RFC850 157 | - time.RFC1123 158 | - time.RFC1123Z 159 | - time.RFC3339 160 | 161 | Timestamp also support a convenient value `now` which will set the value from `time.Now()` at `Default()` method call time. 162 | 163 | ```proto 164 | google.protobuf.Timestamp timestamp = 19 [(defaults.value).timestamp = "now"]; 165 | google.protobuf.Timestamp time_value_field_with_default = 18 [(defaults.value).timestamp = "1952-03-11T00:00:00Z"]; 166 | ``` 167 | 168 | ### Enums 169 | 170 | The enum index value if currently to zero. 171 | 172 | ```proto 173 | enum Enum { 174 | NONE = 0; 175 | ONE = 1; 176 | TWO = 2; 177 | } 178 | Enum enum = 16 [(defaults.value).enum = 1]; 179 | ``` 180 | 181 | ### oneof 182 | 183 | If the `defaults.oneof` option is set, the `oneof` will be initialized with a struct of the *oneof type wrapper*, 184 | the regular field type `default` option will be applied. 185 | 186 | ```proto 187 | oneof one_of { 188 | option (defaults.oneof) = "two"; 189 | OneOfOne one = 29 [(defaults.value).message = {defaults: true, initialize: true}]; 190 | OneOfTwo two = 30 [(defaults.value).message = {defaults: true, initialize: true}]; 191 | OneOfThree three = 31 [(defaults.value).message = {defaults: true, initialize: true}]; 192 | Enum four = 32 [(defaults.value).enum = 1]; 193 | } 194 | ``` 195 | 196 | 197 | ### Repeated and Maps 198 | 199 | `repeated` and `maps` are not supported. 200 | 201 | 202 | ## All types example 203 | ```proto 204 | syntax = "proto3"; 205 | 206 | package tests; 207 | 208 | option go_package = "go.linka.cloud/protoc-gen-defaults/tests/pb;pb"; 209 | 210 | import "defaults/defaults.proto"; 211 | 212 | import "google/protobuf/wrappers.proto"; 213 | import "google/protobuf/timestamp.proto"; 214 | import "google/protobuf/duration.proto"; 215 | 216 | message Types { 217 | // Scalar Field Types 218 | float float = 1 [(defaults.value).float = 0.42]; 219 | double double = 2 [(defaults.value).double = 0.42]; 220 | int32 int32 = 3 [(defaults.value).int32 = 42]; 221 | int64 int64 = 4 [(defaults.value).int64 = 42]; 222 | uint32 uint32 = 5 [(defaults.value).uint32 = 42]; 223 | uint64 uint64 = 6 [(defaults.value).uint64 = 42]; 224 | sint32 sint32 = 7 [(defaults.value).sint32 = 42]; 225 | sint64 sint64 = 8 [(defaults.value).sint64 = 42]; 226 | fixed32 fixed32 = 9 [(defaults.value).fixed32 = 42]; 227 | fixed64 fixed64 = 10 [(defaults.value).fixed64 = 42]; 228 | sfixed32 sfixed32 = 11 [(defaults.value).sfixed32 = 42]; 229 | sfixed64 sfixed64 = 12 [(defaults.value).sfixed64 = 42]; 230 | bool bool = 13 [(defaults.value).bool = true]; 231 | string string = 14 [(defaults.value).string = "42"]; 232 | bytes bytes = 15 [(defaults.value).bytes = "42"]; 233 | 234 | // Complex Field Types 235 | enum Enum { 236 | NONE = 0; 237 | ONE = 1; 238 | TWO = 2; 239 | } 240 | Enum enum = 16 [(defaults.value).enum = 1]; 241 | Message message = 17 [(defaults.value).message = {initialize: true, defaults: false}]; 242 | oneof one_of { 243 | option (defaults.oneof) = "two"; 244 | OneOfOne one = 29 [(defaults.value).message = {defaults: true, initialize: true}]; 245 | OneOfTwo two = 30 [(defaults.value).message = {defaults: true, initialize: true}]; 246 | OneOfThree three = 31 [(defaults.value).message = {defaults: true, initialize: true}]; 247 | Enum four = 32 [(defaults.value).enum = 1]; 248 | } 249 | 250 | // WellKnow types 251 | google.protobuf.Duration duration = 18 [(defaults.value).duration = "2d"]; 252 | google.protobuf.Timestamp timestamp = 19 [(defaults.value).timestamp = "now"]; 253 | google.protobuf.DoubleValue double_value = 20 [(defaults.value).double = 0.42]; 254 | google.protobuf.FloatValue float_value = 21 [(defaults.value).float = 0.42]; 255 | google.protobuf.Int64Value int64_value = 22 [(defaults.value).int64 = 42]; 256 | google.protobuf.UInt64Value uint64_value = 23 [(defaults.value).uint64 = 42]; 257 | google.protobuf.Int32Value int32_value = 24 [(defaults.value).int32 = 42]; 258 | google.protobuf.UInt32Value uint32_value = 25 [(defaults.value).uint32 = 42]; 259 | google.protobuf.BoolValue bool_value = 26 [(defaults.value).bool = false]; 260 | google.protobuf.StringValue string_value = 27 [(defaults.value).string = "42"]; 261 | google.protobuf.BytesValue bytes_value = 28 [(defaults.value).bytes = "42"]; 262 | } 263 | 264 | message Message { 265 | string field = 1 [(defaults.value).string = "lonely field"]; 266 | } 267 | 268 | message OneOfOne { 269 | option (defaults.ignored) = true; 270 | string string_field = 1 [(defaults.value).string = "string_field"]; 271 | } 272 | 273 | message OneOfTwo { 274 | string string_field = 1 [(defaults.value).string = "string_field"]; 275 | } 276 | 277 | message OneOfThree { 278 | option (defaults.disabled) = true; 279 | string string_field = 1 [(defaults.value).string = "string_field"]; 280 | } 281 | 282 | ``` 283 | 284 | ### Using reflection / without code generation 285 | 286 | Setting protobuf message defaults is also supported using reflection: 287 | 288 | ```go 289 | package main 290 | 291 | import ( 292 | pb "..." 293 | "go.linka.cloud/protoc-gen-defaults/defaults" 294 | ) 295 | 296 | func main() { 297 | var msg pb.MyMessage 298 | defaults.Apply(&msg) 299 | } 300 | 301 | ``` 302 | 303 | ## TODO 304 | - [x] docs 305 | - [x] oneof support 306 | - [x] set default values by using [Protobuf reflection](https://pkg.go.dev/google.golang.org/protobuf@v1.27.1/reflect/protoreflect) 307 | - [ ] add more generic methods to use as default value, e.g. *uuid*, *bsonid*... ? 308 | - [ ] repeated support ? 309 | - [ ] maps support ? 310 | - [x] bytes support 311 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 The Linka Cloud Team 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /defaults/defaults.pb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-go. DO NOT EDIT. 16 | // versions: 17 | // protoc-gen-go v1.33.0 18 | // protoc (unknown) 19 | // source: defaults/defaults.proto 20 | 21 | package defaults 22 | 23 | import ( 24 | reflect "reflect" 25 | sync "sync" 26 | 27 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 28 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 29 | descriptorpb "google.golang.org/protobuf/types/descriptorpb" 30 | ) 31 | 32 | const ( 33 | // Verify that this generated code is sufficiently up-to-date. 34 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 35 | // Verify that runtime/protoimpl is sufficiently up-to-date. 36 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 37 | ) 38 | 39 | // FieldDefaults encapsulates the default values for each type of field. Depending on the 40 | // field, the correct set should be used to ensure proper defaults generation. 41 | type FieldDefaults struct { 42 | state protoimpl.MessageState 43 | sizeCache protoimpl.SizeCache 44 | unknownFields protoimpl.UnknownFields 45 | 46 | // Types that are assignable to Type: 47 | // 48 | // *FieldDefaults_Float 49 | // *FieldDefaults_Double 50 | // *FieldDefaults_Int32 51 | // *FieldDefaults_Int64 52 | // *FieldDefaults_Uint32 53 | // *FieldDefaults_Uint64 54 | // *FieldDefaults_Sint32 55 | // *FieldDefaults_Sint64 56 | // *FieldDefaults_Fixed32 57 | // *FieldDefaults_Fixed64 58 | // *FieldDefaults_Sfixed32 59 | // *FieldDefaults_Sfixed64 60 | // *FieldDefaults_Bool 61 | // *FieldDefaults_String_ 62 | // *FieldDefaults_Bytes 63 | // *FieldDefaults_Enum 64 | // *FieldDefaults_Message 65 | // *FieldDefaults_Duration 66 | // *FieldDefaults_Timestamp 67 | Type isFieldDefaults_Type `protobuf_oneof:"type"` 68 | } 69 | 70 | func (x *FieldDefaults) Reset() { 71 | *x = FieldDefaults{} 72 | if protoimpl.UnsafeEnabled { 73 | mi := &file_defaults_defaults_proto_msgTypes[0] 74 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 75 | ms.StoreMessageInfo(mi) 76 | } 77 | } 78 | 79 | func (x *FieldDefaults) String() string { 80 | return protoimpl.X.MessageStringOf(x) 81 | } 82 | 83 | func (*FieldDefaults) ProtoMessage() {} 84 | 85 | func (x *FieldDefaults) ProtoReflect() protoreflect.Message { 86 | mi := &file_defaults_defaults_proto_msgTypes[0] 87 | if protoimpl.UnsafeEnabled && x != nil { 88 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 89 | if ms.LoadMessageInfo() == nil { 90 | ms.StoreMessageInfo(mi) 91 | } 92 | return ms 93 | } 94 | return mi.MessageOf(x) 95 | } 96 | 97 | // Deprecated: Use FieldDefaults.ProtoReflect.Descriptor instead. 98 | func (*FieldDefaults) Descriptor() ([]byte, []int) { 99 | return file_defaults_defaults_proto_rawDescGZIP(), []int{0} 100 | } 101 | 102 | func (m *FieldDefaults) GetType() isFieldDefaults_Type { 103 | if m != nil { 104 | return m.Type 105 | } 106 | return nil 107 | } 108 | 109 | func (x *FieldDefaults) GetFloat() float32 { 110 | if x, ok := x.GetType().(*FieldDefaults_Float); ok { 111 | return x.Float 112 | } 113 | return 0 114 | } 115 | 116 | func (x *FieldDefaults) GetDouble() float64 { 117 | if x, ok := x.GetType().(*FieldDefaults_Double); ok { 118 | return x.Double 119 | } 120 | return 0 121 | } 122 | 123 | func (x *FieldDefaults) GetInt32() int32 { 124 | if x, ok := x.GetType().(*FieldDefaults_Int32); ok { 125 | return x.Int32 126 | } 127 | return 0 128 | } 129 | 130 | func (x *FieldDefaults) GetInt64() int64 { 131 | if x, ok := x.GetType().(*FieldDefaults_Int64); ok { 132 | return x.Int64 133 | } 134 | return 0 135 | } 136 | 137 | func (x *FieldDefaults) GetUint32() uint32 { 138 | if x, ok := x.GetType().(*FieldDefaults_Uint32); ok { 139 | return x.Uint32 140 | } 141 | return 0 142 | } 143 | 144 | func (x *FieldDefaults) GetUint64() uint64 { 145 | if x, ok := x.GetType().(*FieldDefaults_Uint64); ok { 146 | return x.Uint64 147 | } 148 | return 0 149 | } 150 | 151 | func (x *FieldDefaults) GetSint32() int32 { 152 | if x, ok := x.GetType().(*FieldDefaults_Sint32); ok { 153 | return x.Sint32 154 | } 155 | return 0 156 | } 157 | 158 | func (x *FieldDefaults) GetSint64() int64 { 159 | if x, ok := x.GetType().(*FieldDefaults_Sint64); ok { 160 | return x.Sint64 161 | } 162 | return 0 163 | } 164 | 165 | func (x *FieldDefaults) GetFixed32() uint32 { 166 | if x, ok := x.GetType().(*FieldDefaults_Fixed32); ok { 167 | return x.Fixed32 168 | } 169 | return 0 170 | } 171 | 172 | func (x *FieldDefaults) GetFixed64() uint64 { 173 | if x, ok := x.GetType().(*FieldDefaults_Fixed64); ok { 174 | return x.Fixed64 175 | } 176 | return 0 177 | } 178 | 179 | func (x *FieldDefaults) GetSfixed32() int32 { 180 | if x, ok := x.GetType().(*FieldDefaults_Sfixed32); ok { 181 | return x.Sfixed32 182 | } 183 | return 0 184 | } 185 | 186 | func (x *FieldDefaults) GetSfixed64() int64 { 187 | if x, ok := x.GetType().(*FieldDefaults_Sfixed64); ok { 188 | return x.Sfixed64 189 | } 190 | return 0 191 | } 192 | 193 | func (x *FieldDefaults) GetBool() bool { 194 | if x, ok := x.GetType().(*FieldDefaults_Bool); ok { 195 | return x.Bool 196 | } 197 | return false 198 | } 199 | 200 | func (x *FieldDefaults) GetString_() string { 201 | if x, ok := x.GetType().(*FieldDefaults_String_); ok { 202 | return x.String_ 203 | } 204 | return "" 205 | } 206 | 207 | func (x *FieldDefaults) GetBytes() []byte { 208 | if x, ok := x.GetType().(*FieldDefaults_Bytes); ok { 209 | return x.Bytes 210 | } 211 | return nil 212 | } 213 | 214 | func (x *FieldDefaults) GetEnum() uint32 { 215 | if x, ok := x.GetType().(*FieldDefaults_Enum); ok { 216 | return x.Enum 217 | } 218 | return 0 219 | } 220 | 221 | func (x *FieldDefaults) GetMessage() *MessageDefaults { 222 | if x, ok := x.GetType().(*FieldDefaults_Message); ok { 223 | return x.Message 224 | } 225 | return nil 226 | } 227 | 228 | func (x *FieldDefaults) GetDuration() string { 229 | if x, ok := x.GetType().(*FieldDefaults_Duration); ok { 230 | return x.Duration 231 | } 232 | return "" 233 | } 234 | 235 | func (x *FieldDefaults) GetTimestamp() string { 236 | if x, ok := x.GetType().(*FieldDefaults_Timestamp); ok { 237 | return x.Timestamp 238 | } 239 | return "" 240 | } 241 | 242 | type isFieldDefaults_Type interface { 243 | isFieldDefaults_Type() 244 | } 245 | 246 | type FieldDefaults_Float struct { 247 | // Scalar Field Types 248 | Float float32 `protobuf:"fixed32,1,opt,name=float,oneof"` 249 | } 250 | 251 | type FieldDefaults_Double struct { 252 | Double float64 `protobuf:"fixed64,2,opt,name=double,oneof"` 253 | } 254 | 255 | type FieldDefaults_Int32 struct { 256 | Int32 int32 `protobuf:"varint,3,opt,name=int32,oneof"` 257 | } 258 | 259 | type FieldDefaults_Int64 struct { 260 | Int64 int64 `protobuf:"varint,4,opt,name=int64,oneof"` 261 | } 262 | 263 | type FieldDefaults_Uint32 struct { 264 | Uint32 uint32 `protobuf:"varint,5,opt,name=uint32,oneof"` 265 | } 266 | 267 | type FieldDefaults_Uint64 struct { 268 | Uint64 uint64 `protobuf:"varint,6,opt,name=uint64,oneof"` 269 | } 270 | 271 | type FieldDefaults_Sint32 struct { 272 | Sint32 int32 `protobuf:"zigzag32,7,opt,name=sint32,oneof"` 273 | } 274 | 275 | type FieldDefaults_Sint64 struct { 276 | Sint64 int64 `protobuf:"zigzag64,8,opt,name=sint64,oneof"` 277 | } 278 | 279 | type FieldDefaults_Fixed32 struct { 280 | Fixed32 uint32 `protobuf:"fixed32,9,opt,name=fixed32,oneof"` 281 | } 282 | 283 | type FieldDefaults_Fixed64 struct { 284 | Fixed64 uint64 `protobuf:"fixed64,10,opt,name=fixed64,oneof"` 285 | } 286 | 287 | type FieldDefaults_Sfixed32 struct { 288 | Sfixed32 int32 `protobuf:"fixed32,11,opt,name=sfixed32,oneof"` 289 | } 290 | 291 | type FieldDefaults_Sfixed64 struct { 292 | Sfixed64 int64 `protobuf:"fixed64,12,opt,name=sfixed64,oneof"` 293 | } 294 | 295 | type FieldDefaults_Bool struct { 296 | Bool bool `protobuf:"varint,13,opt,name=bool,oneof"` 297 | } 298 | 299 | type FieldDefaults_String_ struct { 300 | String_ string `protobuf:"bytes,14,opt,name=string,oneof"` 301 | } 302 | 303 | type FieldDefaults_Bytes struct { 304 | Bytes []byte `protobuf:"bytes,15,opt,name=bytes,oneof"` 305 | } 306 | 307 | type FieldDefaults_Enum struct { 308 | // Complex Field Types 309 | Enum uint32 `protobuf:"varint,16,opt,name=enum,oneof"` 310 | } 311 | 312 | type FieldDefaults_Message struct { 313 | Message *MessageDefaults `protobuf:"bytes,17,opt,name=message,oneof"` 314 | } 315 | 316 | type FieldDefaults_Duration struct { 317 | // Well-Known Field Types 318 | // any = 20; 319 | Duration string `protobuf:"bytes,21,opt,name=duration,oneof"` 320 | } 321 | 322 | type FieldDefaults_Timestamp struct { 323 | Timestamp string `protobuf:"bytes,22,opt,name=timestamp,oneof"` 324 | } 325 | 326 | func (*FieldDefaults_Float) isFieldDefaults_Type() {} 327 | 328 | func (*FieldDefaults_Double) isFieldDefaults_Type() {} 329 | 330 | func (*FieldDefaults_Int32) isFieldDefaults_Type() {} 331 | 332 | func (*FieldDefaults_Int64) isFieldDefaults_Type() {} 333 | 334 | func (*FieldDefaults_Uint32) isFieldDefaults_Type() {} 335 | 336 | func (*FieldDefaults_Uint64) isFieldDefaults_Type() {} 337 | 338 | func (*FieldDefaults_Sint32) isFieldDefaults_Type() {} 339 | 340 | func (*FieldDefaults_Sint64) isFieldDefaults_Type() {} 341 | 342 | func (*FieldDefaults_Fixed32) isFieldDefaults_Type() {} 343 | 344 | func (*FieldDefaults_Fixed64) isFieldDefaults_Type() {} 345 | 346 | func (*FieldDefaults_Sfixed32) isFieldDefaults_Type() {} 347 | 348 | func (*FieldDefaults_Sfixed64) isFieldDefaults_Type() {} 349 | 350 | func (*FieldDefaults_Bool) isFieldDefaults_Type() {} 351 | 352 | func (*FieldDefaults_String_) isFieldDefaults_Type() {} 353 | 354 | func (*FieldDefaults_Bytes) isFieldDefaults_Type() {} 355 | 356 | func (*FieldDefaults_Enum) isFieldDefaults_Type() {} 357 | 358 | func (*FieldDefaults_Message) isFieldDefaults_Type() {} 359 | 360 | func (*FieldDefaults_Duration) isFieldDefaults_Type() {} 361 | 362 | func (*FieldDefaults_Timestamp) isFieldDefaults_Type() {} 363 | 364 | // MessageDefaults define the default behaviour for this field. 365 | type MessageDefaults struct { 366 | state protoimpl.MessageState 367 | sizeCache protoimpl.SizeCache 368 | unknownFields protoimpl.UnknownFields 369 | 370 | // Initialize specify that the message should be initialized 371 | Initialize *bool `protobuf:"varint,1,opt,name=initialize" json:"initialize,omitempty"` 372 | // Defaults specifies that the messages' defaults should be applied 373 | Defaults *bool `protobuf:"varint,2,opt,name=defaults" json:"defaults,omitempty"` 374 | } 375 | 376 | func (x *MessageDefaults) Reset() { 377 | *x = MessageDefaults{} 378 | if protoimpl.UnsafeEnabled { 379 | mi := &file_defaults_defaults_proto_msgTypes[1] 380 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 381 | ms.StoreMessageInfo(mi) 382 | } 383 | } 384 | 385 | func (x *MessageDefaults) String() string { 386 | return protoimpl.X.MessageStringOf(x) 387 | } 388 | 389 | func (*MessageDefaults) ProtoMessage() {} 390 | 391 | func (x *MessageDefaults) ProtoReflect() protoreflect.Message { 392 | mi := &file_defaults_defaults_proto_msgTypes[1] 393 | if protoimpl.UnsafeEnabled && x != nil { 394 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 395 | if ms.LoadMessageInfo() == nil { 396 | ms.StoreMessageInfo(mi) 397 | } 398 | return ms 399 | } 400 | return mi.MessageOf(x) 401 | } 402 | 403 | // Deprecated: Use MessageDefaults.ProtoReflect.Descriptor instead. 404 | func (*MessageDefaults) Descriptor() ([]byte, []int) { 405 | return file_defaults_defaults_proto_rawDescGZIP(), []int{1} 406 | } 407 | 408 | func (x *MessageDefaults) GetInitialize() bool { 409 | if x != nil && x.Initialize != nil { 410 | return *x.Initialize 411 | } 412 | return false 413 | } 414 | 415 | func (x *MessageDefaults) GetDefaults() bool { 416 | if x != nil && x.Defaults != nil { 417 | return *x.Defaults 418 | } 419 | return false 420 | } 421 | 422 | var file_defaults_defaults_proto_extTypes = []protoimpl.ExtensionInfo{ 423 | { 424 | ExtendedType: (*descriptorpb.MessageOptions)(nil), 425 | ExtensionType: (*bool)(nil), 426 | Field: 1171, 427 | Name: "defaults.disabled", 428 | Tag: "varint,1171,opt,name=disabled", 429 | Filename: "defaults/defaults.proto", 430 | }, 431 | { 432 | ExtendedType: (*descriptorpb.MessageOptions)(nil), 433 | ExtensionType: (*bool)(nil), 434 | Field: 1172, 435 | Name: "defaults.ignored", 436 | Tag: "varint,1172,opt,name=ignored", 437 | Filename: "defaults/defaults.proto", 438 | }, 439 | { 440 | ExtendedType: (*descriptorpb.MessageOptions)(nil), 441 | ExtensionType: (*bool)(nil), 442 | Field: 1173, 443 | Name: "defaults.unexported", 444 | Tag: "varint,1173,opt,name=unexported", 445 | Filename: "defaults/defaults.proto", 446 | }, 447 | { 448 | ExtendedType: (*descriptorpb.OneofOptions)(nil), 449 | ExtensionType: (*string)(nil), 450 | Field: 1171, 451 | Name: "defaults.oneof", 452 | Tag: "bytes,1171,opt,name=oneof", 453 | Filename: "defaults/defaults.proto", 454 | }, 455 | { 456 | ExtendedType: (*descriptorpb.FieldOptions)(nil), 457 | ExtensionType: (*FieldDefaults)(nil), 458 | Field: 1171, 459 | Name: "defaults.value", 460 | Tag: "bytes,1171,opt,name=value", 461 | Filename: "defaults/defaults.proto", 462 | }, 463 | } 464 | 465 | // Extension fields to descriptorpb.MessageOptions. 466 | var ( 467 | // Disabled nullifies any defaults for this message, including any 468 | // message fields associated with it that do support defaults. 469 | // 470 | // optional bool disabled = 1171; 471 | E_Disabled = &file_defaults_defaults_proto_extTypes[0] 472 | // Ignore skips generation of default methods for this message. 473 | // 474 | // optional bool ignored = 1172; 475 | E_Ignored = &file_defaults_defaults_proto_extTypes[1] 476 | // Unexported generate an unexported defaults method, this can 477 | // be useful when we want both the generated defaults and a custom 478 | // defaults method that will call the unexported method. 479 | // 480 | // optional bool unexported = 1173; 481 | E_Unexported = &file_defaults_defaults_proto_extTypes[2] 482 | ) 483 | 484 | // Extension fields to descriptorpb.OneofOptions. 485 | var ( 486 | // optional string oneof = 1171; 487 | E_Oneof = &file_defaults_defaults_proto_extTypes[3] 488 | ) 489 | 490 | // Extension fields to descriptorpb.FieldOptions. 491 | var ( 492 | // Value specify the default value to set on this field. By default, 493 | // none is set on a field. 494 | // 495 | // optional defaults.FieldDefaults value = 1171; 496 | E_Value = &file_defaults_defaults_proto_extTypes[4] 497 | ) 498 | 499 | var File_defaults_defaults_proto protoreflect.FileDescriptor 500 | 501 | var file_defaults_defaults_proto_rawDesc = []byte{ 502 | 0x0a, 0x17, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, 503 | 0x6c, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 504 | 0x6c, 0x74, 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 505 | 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 506 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x04, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 507 | 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 508 | 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x12, 509 | 0x18, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 510 | 0x00, 0x52, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x69, 0x6e, 0x74, 511 | 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x33, 512 | 0x32, 0x12, 0x16, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 513 | 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x06, 0x75, 0x69, 0x6e, 514 | 0x74, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x06, 0x75, 0x69, 0x6e, 515 | 0x74, 0x33, 0x32, 0x12, 0x18, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 516 | 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, 517 | 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x11, 0x48, 0x00, 0x52, 518 | 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 519 | 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x12, 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 520 | 0x34, 0x12, 0x1a, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x09, 0x20, 0x01, 521 | 0x28, 0x07, 0x48, 0x00, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1a, 0x0a, 522 | 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x06, 0x48, 0x00, 523 | 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1c, 0x0a, 0x08, 0x73, 0x66, 0x69, 524 | 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0f, 0x48, 0x00, 0x52, 0x08, 0x73, 525 | 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1c, 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 526 | 0x64, 0x36, 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x10, 0x48, 0x00, 0x52, 0x08, 0x73, 0x66, 0x69, 527 | 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x14, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x0d, 0x20, 528 | 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x06, 0x73, 529 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73, 530 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0f, 531 | 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 532 | 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x04, 0x65, 533 | 0x6e, 0x75, 0x6d, 0x12, 0x35, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 534 | 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 535 | 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x48, 536 | 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x08, 0x64, 0x75, 537 | 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 538 | 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 539 | 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x74, 540 | 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 541 | 0x4a, 0x04, 0x08, 0x12, 0x10, 0x15, 0x22, 0x4d, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 542 | 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x69, 543 | 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 544 | 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x66, 545 | 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x65, 0x66, 546 | 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3a, 0x3c, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 547 | 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 548 | 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 549 | 0x6e, 0x73, 0x18, 0x93, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 550 | 0x6c, 0x65, 0x64, 0x3a, 0x3a, 0x0a, 0x07, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x1f, 551 | 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 552 | 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 553 | 0x94, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3a, 554 | 0x40, 0x0a, 0x0a, 0x75, 0x6e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x2e, 555 | 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 556 | 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x95, 557 | 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x75, 0x6e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 558 | 0x64, 0x3a, 0x34, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 559 | 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 560 | 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x93, 0x09, 0x20, 0x01, 0x28, 0x09, 561 | 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x3a, 0x4d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 562 | 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 563 | 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 564 | 0x93, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 565 | 0x73, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x52, 566 | 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x6f, 0x2e, 0x6c, 0x69, 0x6e, 567 | 0x6b, 0x61, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 568 | 0x67, 0x65, 0x6e, 0x2d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x64, 0x65, 0x66, 569 | 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 570 | } 571 | 572 | var ( 573 | file_defaults_defaults_proto_rawDescOnce sync.Once 574 | file_defaults_defaults_proto_rawDescData = file_defaults_defaults_proto_rawDesc 575 | ) 576 | 577 | func file_defaults_defaults_proto_rawDescGZIP() []byte { 578 | file_defaults_defaults_proto_rawDescOnce.Do(func() { 579 | file_defaults_defaults_proto_rawDescData = protoimpl.X.CompressGZIP(file_defaults_defaults_proto_rawDescData) 580 | }) 581 | return file_defaults_defaults_proto_rawDescData 582 | } 583 | 584 | var file_defaults_defaults_proto_msgTypes = make([]protoimpl.MessageInfo, 2) 585 | var file_defaults_defaults_proto_goTypes = []interface{}{ 586 | (*FieldDefaults)(nil), // 0: defaults.FieldDefaults 587 | (*MessageDefaults)(nil), // 1: defaults.MessageDefaults 588 | (*descriptorpb.MessageOptions)(nil), // 2: google.protobuf.MessageOptions 589 | (*descriptorpb.OneofOptions)(nil), // 3: google.protobuf.OneofOptions 590 | (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions 591 | } 592 | var file_defaults_defaults_proto_depIdxs = []int32{ 593 | 1, // 0: defaults.FieldDefaults.message:type_name -> defaults.MessageDefaults 594 | 2, // 1: defaults.disabled:extendee -> google.protobuf.MessageOptions 595 | 2, // 2: defaults.ignored:extendee -> google.protobuf.MessageOptions 596 | 2, // 3: defaults.unexported:extendee -> google.protobuf.MessageOptions 597 | 3, // 4: defaults.oneof:extendee -> google.protobuf.OneofOptions 598 | 4, // 5: defaults.value:extendee -> google.protobuf.FieldOptions 599 | 0, // 6: defaults.value:type_name -> defaults.FieldDefaults 600 | 7, // [7:7] is the sub-list for method output_type 601 | 7, // [7:7] is the sub-list for method input_type 602 | 6, // [6:7] is the sub-list for extension type_name 603 | 1, // [1:6] is the sub-list for extension extendee 604 | 0, // [0:1] is the sub-list for field type_name 605 | } 606 | 607 | func init() { file_defaults_defaults_proto_init() } 608 | func file_defaults_defaults_proto_init() { 609 | if File_defaults_defaults_proto != nil { 610 | return 611 | } 612 | if !protoimpl.UnsafeEnabled { 613 | file_defaults_defaults_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 614 | switch v := v.(*FieldDefaults); i { 615 | case 0: 616 | return &v.state 617 | case 1: 618 | return &v.sizeCache 619 | case 2: 620 | return &v.unknownFields 621 | default: 622 | return nil 623 | } 624 | } 625 | file_defaults_defaults_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 626 | switch v := v.(*MessageDefaults); i { 627 | case 0: 628 | return &v.state 629 | case 1: 630 | return &v.sizeCache 631 | case 2: 632 | return &v.unknownFields 633 | default: 634 | return nil 635 | } 636 | } 637 | } 638 | file_defaults_defaults_proto_msgTypes[0].OneofWrappers = []interface{}{ 639 | (*FieldDefaults_Float)(nil), 640 | (*FieldDefaults_Double)(nil), 641 | (*FieldDefaults_Int32)(nil), 642 | (*FieldDefaults_Int64)(nil), 643 | (*FieldDefaults_Uint32)(nil), 644 | (*FieldDefaults_Uint64)(nil), 645 | (*FieldDefaults_Sint32)(nil), 646 | (*FieldDefaults_Sint64)(nil), 647 | (*FieldDefaults_Fixed32)(nil), 648 | (*FieldDefaults_Fixed64)(nil), 649 | (*FieldDefaults_Sfixed32)(nil), 650 | (*FieldDefaults_Sfixed64)(nil), 651 | (*FieldDefaults_Bool)(nil), 652 | (*FieldDefaults_String_)(nil), 653 | (*FieldDefaults_Bytes)(nil), 654 | (*FieldDefaults_Enum)(nil), 655 | (*FieldDefaults_Message)(nil), 656 | (*FieldDefaults_Duration)(nil), 657 | (*FieldDefaults_Timestamp)(nil), 658 | } 659 | type x struct{} 660 | out := protoimpl.TypeBuilder{ 661 | File: protoimpl.DescBuilder{ 662 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 663 | RawDescriptor: file_defaults_defaults_proto_rawDesc, 664 | NumEnums: 0, 665 | NumMessages: 2, 666 | NumExtensions: 5, 667 | NumServices: 0, 668 | }, 669 | GoTypes: file_defaults_defaults_proto_goTypes, 670 | DependencyIndexes: file_defaults_defaults_proto_depIdxs, 671 | MessageInfos: file_defaults_defaults_proto_msgTypes, 672 | ExtensionInfos: file_defaults_defaults_proto_extTypes, 673 | }.Build() 674 | File_defaults_defaults_proto = out.File 675 | file_defaults_defaults_proto_rawDesc = nil 676 | file_defaults_defaults_proto_goTypes = nil 677 | file_defaults_defaults_proto_depIdxs = nil 678 | } 679 | -------------------------------------------------------------------------------- /.bingo/buf.sum: -------------------------------------------------------------------------------- 1 | buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240928190436-5e8abcfd7a7e.2 h1:BQVQ0fcYgqpe6F/2ZPJUR1rTN+nwdrj2z7IAbAu9XAQ= 2 | buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240928190436-5e8abcfd7a7e.2/go.mod h1:B+9TKHRYqoAUW57pLjhkLOnBCu0DQYMV+f7imQ9nXwI= 3 | buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240920164238-5a7b106cbb87.2 h1:hl0FrmGlNpQZIGvU1/jDz0lsPDd0BhCE0QDRwPfLZcA= 4 | buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240920164238-5a7b106cbb87.2/go.mod h1:ylS4c28ACSI59oJrOdW4pHS4n0Hw4TgSPHn8rpHl4Yw= 5 | buf.build/gen/go/bufbuild/registry/connectrpc/go v1.17.0-20240925012807-1610ffa05635.1 h1:p4A9QnhBrKjCquBt1mKqfO37QseLwgWqQp+Wb9ZjasE= 6 | buf.build/gen/go/bufbuild/registry/connectrpc/go v1.17.0-20240925012807-1610ffa05635.1/go.mod h1:7WtU+waNF+dyxDsuNaqmG3d0w3y2poNju8cvun1/jLs= 7 | buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.34.2-20240925012807-1610ffa05635.2 h1:3sSS9z8k6zVe7rNNt9R6DN2fOFBVClEflmICIjbXwms= 8 | buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.34.2-20240925012807-1610ffa05635.2/go.mod h1:psseUmlKRo9v5LZJtR/aTpdTLuyp9o3X7rnLT87SZEo= 9 | buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.34.2-20240828222655-5345c0a56177.2 h1:oSi+Adw4xvIjXrW8eY8QGR3sBdfWeY5HN/RefnRt52M= 10 | buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.34.2-20240828222655-5345c0a56177.2/go.mod h1:GjH0gjlY/ns16X8d6eaXV2W+6IFwsO5Ly9WVnzyd1E0= 11 | buf.build/go/bufplugin v0.5.0 h1:pmK1AloAMp+4woH5hEisK9qVmDdLySzIKexUUVZLJ2Q= 12 | buf.build/go/bufplugin v0.5.0/go.mod h1:r7Y8tpqpErLtUXUecEgwAHnjihY03YbN0IaBFNJF/x0= 13 | buf.build/go/protoyaml v0.2.0 h1:2g3OHjtLDqXBREIOjpZGHmQ+U/4mkN1YiQjxNB68Ip8= 14 | buf.build/go/protoyaml v0.2.0/go.mod h1:L/9QvTDkTWcDTzAL6HMfN+mYC6CmZRm2KnsUA054iL0= 15 | buf.build/go/spdx v0.2.0 h1:IItqM0/cMxvFJJumcBuP8NrsIzMs/UYjp/6WSpq8LTw= 16 | buf.build/go/spdx v0.2.0/go.mod h1:bXdwQFem9Si3nsbNy8aJKGPoaPi5DKwdeEp5/ArZ6w8= 17 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 18 | connectrpc.com/connect v1.17.0 h1:W0ZqMhtVzn9Zhn2yATuUokDLO5N+gIuBWMOnsQrfmZk= 19 | connectrpc.com/connect v1.17.0/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= 20 | connectrpc.com/otelconnect v0.7.1 h1:scO5pOb0i4yUE66CnNrHeK1x51yq0bE0ehPg6WvzXJY= 21 | connectrpc.com/otelconnect v0.7.1/go.mod h1:dh3bFgHBTb2bkqGCeVVOtHJreSns7uu9wwL2Tbz17ms= 22 | github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= 23 | github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= 24 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 25 | github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= 26 | github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= 27 | github.com/Microsoft/hcsshim v0.12.7 h1:MP6R1spmjxTE4EU4J3YsrTxn8CjvN9qwjTKJXldFaRg= 28 | github.com/Microsoft/hcsshim v0.12.7/go.mod h1:HPbAuJ9BvQYYZbB4yEQcyGIsTP5L4yHKeO9XO149AEM= 29 | github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= 30 | github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= 31 | github.com/bufbuild/buf v1.45.0 h1:WdaM5OCjqEURmzOiz3h9gVilFXqWpt6X+zbOVqKti1A= 32 | github.com/bufbuild/buf v1.45.0/go.mod h1:j+GjGIKS+CvubKtPiC0KpEiHAd3wS9/5sn2/U5WlA20= 33 | github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= 34 | github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= 35 | github.com/bufbuild/protoplugin v0.0.0-20240911180120-7bb73e41a54a h1:l3RhVoG0RtC61h6TVWnkniGj4TgBebuyPQRdleFAmTg= 36 | github.com/bufbuild/protoplugin v0.0.0-20240911180120-7bb73e41a54a/go.mod h1:c5D8gWRIZ2HLWO3gXYTtUfw/hbJyD8xikv2ooPxnklQ= 37 | github.com/bufbuild/protovalidate-go v0.7.2 h1:UuvKyZHl5p7u3ztEjtRtqtDxOjRKX5VUOgKFq6p6ETk= 38 | github.com/bufbuild/protovalidate-go v0.7.2/go.mod h1:PHV5pFuWlRzdDW02/cmVyNzdiQ+RNNwo7idGxdzS7o4= 39 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 40 | github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= 41 | github.com/chromedp/chromedp v0.9.2/go.mod h1:LkSXJKONWTCHAfQasKFUZI+mxqS4tZqhmtGzzhLsnLs= 42 | github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww= 43 | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= 44 | github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= 45 | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= 46 | github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= 47 | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= 48 | github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= 49 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 50 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 51 | github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0= 52 | github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0= 53 | github.com/containerd/containerd v1.7.22 h1:nZuNnNRA6T6jB975rx2RRNqqH2k6ELYKDZfqTHqwyy0= 54 | github.com/containerd/containerd v1.7.22/go.mod h1:e3Jz1rYRUZ2Lt51YrH9Rz0zPyJBOlSvB3ghr2jbVD8g= 55 | github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= 56 | github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= 57 | github.com/containerd/errdefs v0.2.0 h1:XllDESRfJtVrMwMmR2mCabxyvBK4UlbyyiWI3MvRw0o= 58 | github.com/containerd/errdefs v0.2.0/go.mod h1:C28ixlj3dKhQS9hsQ13b+HIb4X7+s2G4FYhbSPcRDLM= 59 | github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= 60 | github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= 61 | github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= 62 | github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= 63 | github.com/containerd/stargz-snapshotter/estargz v0.15.1 h1:eXJjw9RbkLFgioVaTG+G/ZW/0kEe2oEKCdS/ZxIyoCU= 64 | github.com/containerd/stargz-snapshotter/estargz v0.15.1/go.mod h1:gr2RNwukQ/S9Nv33Lt6UC7xEx58C+LHRdoqbEKjz1Kk= 65 | github.com/containerd/ttrpc v1.2.5 h1:IFckT1EFQoFBMG4c3sMdT8EP3/aKfumK1msY+Ze4oLU= 66 | github.com/containerd/ttrpc v1.2.5/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o= 67 | github.com/containerd/typeurl/v2 v2.2.0 h1:6NBDbQzr7I5LHgp34xAXYF5DOTQDn05X58lsPEmzLso= 68 | github.com/containerd/typeurl/v2 v2.2.0/go.mod h1:8XOOxnyatxSWuG8OfsZXVnAF4iZfedjS/8UHSPJnX4g= 69 | github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 70 | github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= 71 | github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 72 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 73 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 74 | github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= 75 | github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= 76 | github.com/docker/cli v27.3.1+incompatible h1:qEGdFBF3Xu6SCvCYhc7CzaQTlBmqDuzxPDpigSyeKQQ= 77 | github.com/docker/cli v27.3.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= 78 | github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= 79 | github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= 80 | github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI= 81 | github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= 82 | github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo= 83 | github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= 84 | github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= 85 | github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= 86 | github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= 87 | github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= 88 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 89 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 90 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 91 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 92 | github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= 93 | github.com/felixge/fgprof v0.9.5 h1:8+vR6yu2vvSKn08urWyEuxx75NWPEvybbkBirEpsbVY= 94 | github.com/felixge/fgprof v0.9.5/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM= 95 | github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= 96 | github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= 97 | github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= 98 | github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= 99 | github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 100 | github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= 101 | github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 102 | github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 103 | github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 104 | github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= 105 | github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= 106 | github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= 107 | github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= 108 | github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= 109 | github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= 110 | github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= 111 | github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 112 | github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 113 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 114 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 115 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= 116 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 117 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 118 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 119 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 120 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 121 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 122 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 123 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 124 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 125 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 126 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 127 | github.com/google/cel-go v0.21.0 h1:cl6uW/gxN+Hy50tNYvI691+sXxioCnstFzLp2WO4GCI= 128 | github.com/google/cel-go v0.21.0/go.mod h1:rHUlWCcBKgyEk+eV03RPdZUekPp6YcJwV0FxuUksYxc= 129 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 130 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 131 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 132 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 133 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 134 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 135 | github.com/google/go-containerregistry v0.20.2 h1:B1wPJ1SN/S7pB+ZAimcciVD+r+yV/l/DSArMxlbwseo= 136 | github.com/google/go-containerregistry v0.20.2/go.mod h1:z38EKdKh4h7IP2gSfUUqEvalZBqs6AoLeWfUy34nQC8= 137 | github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= 138 | github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= 139 | github.com/google/pprof v0.0.0-20241001023024-f4c0cfd0cf1d h1:Jaz2JzpQaQXyET0AjLBXShrthbpqMkhGiEfkcQAiAUs= 140 | github.com/google/pprof v0.0.0-20241001023024-f4c0cfd0cf1d/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= 141 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 142 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 143 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 144 | github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= 145 | github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw= 146 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 147 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 148 | github.com/jdx/go-netrc v1.0.0 h1:QbLMLyCZGj0NA8glAhxUpf1zDg6cxnWgMBbjq40W0gQ= 149 | github.com/jdx/go-netrc v1.0.0/go.mod h1:Gh9eFQJnoTNIRHXl2j5bJXA1u84hQWJWgGh569zF3v8= 150 | github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= 151 | github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= 152 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 153 | github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= 154 | github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 155 | github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= 156 | github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= 157 | github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= 158 | github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 159 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 160 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 161 | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= 162 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 163 | github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= 164 | github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= 165 | github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= 166 | github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= 167 | github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= 168 | github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= 169 | github.com/moby/sys/mount v0.3.4 h1:yn5jq4STPztkkzSKpZkLcmjue+bZJ0u2AuQY1iNI1Ww= 170 | github.com/moby/sys/mount v0.3.4/go.mod h1:KcQJMbQdJHPlq5lcYT+/CjatWM4PuxKe+XLSVS4J6Os= 171 | github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg= 172 | github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4= 173 | github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= 174 | github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= 175 | github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= 176 | github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= 177 | github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= 178 | github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= 179 | github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= 180 | github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= 181 | github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= 182 | github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= 183 | github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= 184 | github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= 185 | github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= 186 | github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= 187 | github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= 188 | github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= 189 | github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= 190 | github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= 191 | github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= 192 | github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= 193 | github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= 194 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 195 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 196 | github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= 197 | github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= 198 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 199 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 200 | github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= 201 | github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= 202 | github.com/quic-go/quic-go v0.47.0 h1:yXs3v7r2bm1wmPTYNLKAAJTHMYkPEsfYJmTazXrCZ7Y= 203 | github.com/quic-go/quic-go v0.47.0/go.mod h1:3bCapYsJvXGZcipOHuu7plYtaV6tnF+z7wIFsU0WK9E= 204 | github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= 205 | github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= 206 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 207 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 208 | github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= 209 | github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= 210 | github.com/segmentio/encoding v0.4.0 h1:MEBYvRqiUB2nfR2criEXWqwdY6HJOUrCn5hboVOVmy8= 211 | github.com/segmentio/encoding v0.4.0/go.mod h1:/d03Cd8PoaDeceuhUUUQWjU0KhWjrmYrWPgtJHYZSnI= 212 | github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= 213 | github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 214 | github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= 215 | github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= 216 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 217 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 218 | github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= 219 | github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= 220 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 221 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 222 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 223 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 224 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 225 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 226 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 227 | github.com/tetratelabs/wazero v1.8.1 h1:NrcgVbWfkWvVc4UtT4LRLDf91PsOzDzefMdwhLfA550= 228 | github.com/tetratelabs/wazero v1.8.1/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= 229 | github.com/vbatts/tar-split v0.11.6 h1:4SjTW5+PU11n6fZenf2IPoV8/tz3AaYHMWjf23envGs= 230 | github.com/vbatts/tar-split v0.11.6/go.mod h1:dqKNtesIOr2j2Qv3W/cHjnvk9I8+G7oAkFDFN6TCBEI= 231 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 232 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 233 | go.lsp.dev/jsonrpc2 v0.10.0 h1:Pr/YcXJoEOTMc/b6OTmcR1DPJ3mSWl/SWiU1Cct6VmI= 234 | go.lsp.dev/jsonrpc2 v0.10.0/go.mod h1:fmEzIdXPi/rf6d4uFcayi8HpFP1nBF99ERP1htC72Ac= 235 | go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 h1:hCzQgh6UcwbKgNSRurYWSqh8MufqRRPODRBblutn4TE= 236 | go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2/go.mod h1:gtSHRuYfbCT0qnbLnovpie/WEmqyJ7T4n6VXiFMBtcw= 237 | go.lsp.dev/protocol v0.12.0 h1:tNprUI9klQW5FAFVM4Sa+AbPFuVQByWhP1ttNUAjIWg= 238 | go.lsp.dev/protocol v0.12.0/go.mod h1:Qb11/HgZQ72qQbeyPfJbu3hZBH23s1sr4st8czGeDMQ= 239 | go.lsp.dev/uri v0.3.0 h1:KcZJmh6nFIBeJzTugn5JTU6OOyG0lDOo3R9KwTxTYbo= 240 | go.lsp.dev/uri v0.3.0/go.mod h1:P5sbO1IQR+qySTWOCnhnK7phBx+W3zbLqSMDJNTw88I= 241 | go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= 242 | go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= 243 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 h1:ZIg3ZT/aQ7AfKqdwp7ECpOK6vHqquXXuyTjIO8ZdmPs= 244 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0/go.mod h1:DQAwmETtZV00skUwgD6+0U89g80NKsJE3DCKeLLPQMI= 245 | go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= 246 | go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= 247 | go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= 248 | go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= 249 | go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= 250 | go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= 251 | go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= 252 | go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= 253 | go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= 254 | go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= 255 | go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= 256 | go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= 257 | go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= 258 | go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= 259 | go.uber.org/zap/exp v0.1.1-0.20240913022758-ede8e1888f83 h1:wpjRiPjppWaUIH+GC0bRvsdaH2K4Dw49dEJa7MX01Mk= 260 | go.uber.org/zap/exp v0.1.1-0.20240913022758-ede8e1888f83/go.mod h1:5I384qq7XGxYyByIhHm6jg5CHkGY0nsTfbDLgDDlgJQ= 261 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 262 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 263 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 264 | golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= 265 | golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= 266 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 267 | golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= 268 | golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 269 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 270 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 271 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 272 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 273 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 274 | golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= 275 | golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 276 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 277 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 278 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 279 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 280 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 281 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 282 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 283 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 284 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 285 | golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= 286 | golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 287 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 288 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 289 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 290 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 291 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 292 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 293 | golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= 294 | golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 295 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 296 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 297 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 298 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 299 | golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 300 | golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 301 | golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 302 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 303 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 304 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 305 | golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= 306 | golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 307 | golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= 308 | golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= 309 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 310 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 311 | golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= 312 | golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 313 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 314 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 315 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 316 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 317 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 318 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 319 | golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 320 | golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 321 | golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= 322 | golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= 323 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 324 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 325 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 326 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 327 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 328 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 329 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 330 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 331 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 332 | google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= 333 | google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= 334 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= 335 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= 336 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 337 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 338 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 339 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 340 | google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= 341 | google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= 342 | google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= 343 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 344 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 345 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 346 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 347 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 348 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 349 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 350 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 351 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 352 | google.golang.org/protobuf v1.34.3-0.20240906163944-03df6c145d96 h1:gqpvySYmKe3qf25lfA3WIEMTXBU+lfISbNkPH2BA844= 353 | google.golang.org/protobuf v1.34.3-0.20240906163944-03df6c145d96/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 354 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 355 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 356 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 357 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 358 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 359 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 360 | pluginrpc.com/pluginrpc v0.5.0 h1:tOQj2D35hOmvHyPu8e7ohW2/QvAnEtKscy2IJYWQ2yo= 361 | pluginrpc.com/pluginrpc v0.5.0/go.mod h1:UNWZ941hcVAoOZUn8YZsMmOZBzbUjQa3XMns8RQLp9o= 362 | -------------------------------------------------------------------------------- /tests/pb/types.pb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-go. DO NOT EDIT. 16 | // versions: 17 | // protoc-gen-go v1.33.0 18 | // protoc (unknown) 19 | // source: tests/pb/types.proto 20 | 21 | package pb 22 | 23 | import ( 24 | reflect "reflect" 25 | sync "sync" 26 | 27 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 28 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 29 | durationpb "google.golang.org/protobuf/types/known/durationpb" 30 | timestamppb "google.golang.org/protobuf/types/known/timestamppb" 31 | wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 32 | 33 | _ "go.linka.cloud/protoc-gen-defaults/defaults" 34 | ) 35 | 36 | const ( 37 | // Verify that this generated code is sufficiently up-to-date. 38 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 39 | // Verify that runtime/protoimpl is sufficiently up-to-date. 40 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 41 | ) 42 | 43 | // Complex Field Types 44 | type Types_Enum int32 45 | 46 | const ( 47 | Types_NONE Types_Enum = 0 48 | Types_ONE Types_Enum = 1 49 | Types_TWO Types_Enum = 2 50 | ) 51 | 52 | // Enum value maps for Types_Enum. 53 | var ( 54 | Types_Enum_name = map[int32]string{ 55 | 0: "NONE", 56 | 1: "ONE", 57 | 2: "TWO", 58 | } 59 | Types_Enum_value = map[string]int32{ 60 | "NONE": 0, 61 | "ONE": 1, 62 | "TWO": 2, 63 | } 64 | ) 65 | 66 | func (x Types_Enum) Enum() *Types_Enum { 67 | p := new(Types_Enum) 68 | *p = x 69 | return p 70 | } 71 | 72 | func (x Types_Enum) String() string { 73 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) 74 | } 75 | 76 | func (Types_Enum) Descriptor() protoreflect.EnumDescriptor { 77 | return file_tests_pb_types_proto_enumTypes[0].Descriptor() 78 | } 79 | 80 | func (Types_Enum) Type() protoreflect.EnumType { 81 | return &file_tests_pb_types_proto_enumTypes[0] 82 | } 83 | 84 | func (x Types_Enum) Number() protoreflect.EnumNumber { 85 | return protoreflect.EnumNumber(x) 86 | } 87 | 88 | // Deprecated: Use Types_Enum.Descriptor instead. 89 | func (Types_Enum) EnumDescriptor() ([]byte, []int) { 90 | return file_tests_pb_types_proto_rawDescGZIP(), []int{0, 0} 91 | } 92 | 93 | type Types struct { 94 | state protoimpl.MessageState 95 | sizeCache protoimpl.SizeCache 96 | unknownFields protoimpl.UnknownFields 97 | 98 | // Scalar Field Types 99 | Float float32 `protobuf:"fixed32,1,opt,name=float,proto3" json:"float,omitempty"` 100 | Double float64 `protobuf:"fixed64,2,opt,name=double,proto3" json:"double,omitempty"` 101 | Int32 int32 `protobuf:"varint,3,opt,name=int32,proto3" json:"int32,omitempty"` 102 | Int64 int64 `protobuf:"varint,4,opt,name=int64,proto3" json:"int64,omitempty"` 103 | Uint32 uint32 `protobuf:"varint,5,opt,name=uint32,proto3" json:"uint32,omitempty"` 104 | Uint64 uint64 `protobuf:"varint,6,opt,name=uint64,proto3" json:"uint64,omitempty"` 105 | Sint32 int32 `protobuf:"zigzag32,7,opt,name=sint32,proto3" json:"sint32,omitempty"` 106 | Sint64 int64 `protobuf:"zigzag64,8,opt,name=sint64,proto3" json:"sint64,omitempty"` 107 | Fixed32 uint32 `protobuf:"fixed32,9,opt,name=fixed32,proto3" json:"fixed32,omitempty"` 108 | Fixed64 uint64 `protobuf:"fixed64,10,opt,name=fixed64,proto3" json:"fixed64,omitempty"` 109 | Sfixed32 int32 `protobuf:"fixed32,11,opt,name=sfixed32,proto3" json:"sfixed32,omitempty"` 110 | Sfixed64 int64 `protobuf:"fixed64,12,opt,name=sfixed64,proto3" json:"sfixed64,omitempty"` 111 | Bool bool `protobuf:"varint,13,opt,name=bool,proto3" json:"bool,omitempty"` 112 | String_ string `protobuf:"bytes,14,opt,name=string,proto3" json:"string,omitempty"` 113 | Bytes []byte `protobuf:"bytes,15,opt,name=bytes,proto3" json:"bytes,omitempty"` 114 | Enum Types_Enum `protobuf:"varint,16,opt,name=enum,proto3,enum=tests.Types_Enum" json:"enum,omitempty"` 115 | Message *Message `protobuf:"bytes,17,opt,name=message,proto3" json:"message,omitempty"` 116 | // Types that are assignable to Oneof: 117 | // 118 | // *Types_One 119 | // *Types_Two 120 | // *Types_Three 121 | // *Types_Four 122 | Oneof isTypes_Oneof `protobuf_oneof:"oneof"` 123 | // WellKnow types 124 | Duration *durationpb.Duration `protobuf:"bytes,18,opt,name=duration,proto3" json:"duration,omitempty"` 125 | Timestamp *timestamppb.Timestamp `protobuf:"bytes,19,opt,name=timestamp,proto3" json:"timestamp,omitempty"` 126 | DoubleValue *wrapperspb.DoubleValue `protobuf:"bytes,20,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` 127 | FloatValue *wrapperspb.FloatValue `protobuf:"bytes,21,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` 128 | Int64Value *wrapperspb.Int64Value `protobuf:"bytes,22,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` 129 | Uint64Value *wrapperspb.UInt64Value `protobuf:"bytes,23,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` 130 | Int32Value *wrapperspb.Int32Value `protobuf:"bytes,24,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` 131 | Uint32Value *wrapperspb.UInt32Value `protobuf:"bytes,25,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` 132 | BoolValue *wrapperspb.BoolValue `protobuf:"bytes,26,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` 133 | StringValue *wrapperspb.StringValue `protobuf:"bytes,27,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` 134 | BytesValue *wrapperspb.BytesValue `protobuf:"bytes,28,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` 135 | } 136 | 137 | func (x *Types) Reset() { 138 | *x = Types{} 139 | if protoimpl.UnsafeEnabled { 140 | mi := &file_tests_pb_types_proto_msgTypes[0] 141 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 142 | ms.StoreMessageInfo(mi) 143 | } 144 | } 145 | 146 | func (x *Types) String() string { 147 | return protoimpl.X.MessageStringOf(x) 148 | } 149 | 150 | func (*Types) ProtoMessage() {} 151 | 152 | func (x *Types) ProtoReflect() protoreflect.Message { 153 | mi := &file_tests_pb_types_proto_msgTypes[0] 154 | if protoimpl.UnsafeEnabled && x != nil { 155 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 156 | if ms.LoadMessageInfo() == nil { 157 | ms.StoreMessageInfo(mi) 158 | } 159 | return ms 160 | } 161 | return mi.MessageOf(x) 162 | } 163 | 164 | // Deprecated: Use Types.ProtoReflect.Descriptor instead. 165 | func (*Types) Descriptor() ([]byte, []int) { 166 | return file_tests_pb_types_proto_rawDescGZIP(), []int{0} 167 | } 168 | 169 | func (x *Types) GetFloat() float32 { 170 | if x != nil { 171 | return x.Float 172 | } 173 | return 0 174 | } 175 | 176 | func (x *Types) GetDouble() float64 { 177 | if x != nil { 178 | return x.Double 179 | } 180 | return 0 181 | } 182 | 183 | func (x *Types) GetInt32() int32 { 184 | if x != nil { 185 | return x.Int32 186 | } 187 | return 0 188 | } 189 | 190 | func (x *Types) GetInt64() int64 { 191 | if x != nil { 192 | return x.Int64 193 | } 194 | return 0 195 | } 196 | 197 | func (x *Types) GetUint32() uint32 { 198 | if x != nil { 199 | return x.Uint32 200 | } 201 | return 0 202 | } 203 | 204 | func (x *Types) GetUint64() uint64 { 205 | if x != nil { 206 | return x.Uint64 207 | } 208 | return 0 209 | } 210 | 211 | func (x *Types) GetSint32() int32 { 212 | if x != nil { 213 | return x.Sint32 214 | } 215 | return 0 216 | } 217 | 218 | func (x *Types) GetSint64() int64 { 219 | if x != nil { 220 | return x.Sint64 221 | } 222 | return 0 223 | } 224 | 225 | func (x *Types) GetFixed32() uint32 { 226 | if x != nil { 227 | return x.Fixed32 228 | } 229 | return 0 230 | } 231 | 232 | func (x *Types) GetFixed64() uint64 { 233 | if x != nil { 234 | return x.Fixed64 235 | } 236 | return 0 237 | } 238 | 239 | func (x *Types) GetSfixed32() int32 { 240 | if x != nil { 241 | return x.Sfixed32 242 | } 243 | return 0 244 | } 245 | 246 | func (x *Types) GetSfixed64() int64 { 247 | if x != nil { 248 | return x.Sfixed64 249 | } 250 | return 0 251 | } 252 | 253 | func (x *Types) GetBool() bool { 254 | if x != nil { 255 | return x.Bool 256 | } 257 | return false 258 | } 259 | 260 | func (x *Types) GetString_() string { 261 | if x != nil { 262 | return x.String_ 263 | } 264 | return "" 265 | } 266 | 267 | func (x *Types) GetBytes() []byte { 268 | if x != nil { 269 | return x.Bytes 270 | } 271 | return nil 272 | } 273 | 274 | func (x *Types) GetEnum() Types_Enum { 275 | if x != nil { 276 | return x.Enum 277 | } 278 | return Types_NONE 279 | } 280 | 281 | func (x *Types) GetMessage() *Message { 282 | if x != nil { 283 | return x.Message 284 | } 285 | return nil 286 | } 287 | 288 | func (m *Types) GetOneof() isTypes_Oneof { 289 | if m != nil { 290 | return m.Oneof 291 | } 292 | return nil 293 | } 294 | 295 | func (x *Types) GetOne() *OneOfOne { 296 | if x, ok := x.GetOneof().(*Types_One); ok { 297 | return x.One 298 | } 299 | return nil 300 | } 301 | 302 | func (x *Types) GetTwo() *OneOfTwo { 303 | if x, ok := x.GetOneof().(*Types_Two); ok { 304 | return x.Two 305 | } 306 | return nil 307 | } 308 | 309 | func (x *Types) GetThree() *OneOfThree { 310 | if x, ok := x.GetOneof().(*Types_Three); ok { 311 | return x.Three 312 | } 313 | return nil 314 | } 315 | 316 | func (x *Types) GetFour() Types_Enum { 317 | if x, ok := x.GetOneof().(*Types_Four); ok { 318 | return x.Four 319 | } 320 | return Types_NONE 321 | } 322 | 323 | func (x *Types) GetDuration() *durationpb.Duration { 324 | if x != nil { 325 | return x.Duration 326 | } 327 | return nil 328 | } 329 | 330 | func (x *Types) GetTimestamp() *timestamppb.Timestamp { 331 | if x != nil { 332 | return x.Timestamp 333 | } 334 | return nil 335 | } 336 | 337 | func (x *Types) GetDoubleValue() *wrapperspb.DoubleValue { 338 | if x != nil { 339 | return x.DoubleValue 340 | } 341 | return nil 342 | } 343 | 344 | func (x *Types) GetFloatValue() *wrapperspb.FloatValue { 345 | if x != nil { 346 | return x.FloatValue 347 | } 348 | return nil 349 | } 350 | 351 | func (x *Types) GetInt64Value() *wrapperspb.Int64Value { 352 | if x != nil { 353 | return x.Int64Value 354 | } 355 | return nil 356 | } 357 | 358 | func (x *Types) GetUint64Value() *wrapperspb.UInt64Value { 359 | if x != nil { 360 | return x.Uint64Value 361 | } 362 | return nil 363 | } 364 | 365 | func (x *Types) GetInt32Value() *wrapperspb.Int32Value { 366 | if x != nil { 367 | return x.Int32Value 368 | } 369 | return nil 370 | } 371 | 372 | func (x *Types) GetUint32Value() *wrapperspb.UInt32Value { 373 | if x != nil { 374 | return x.Uint32Value 375 | } 376 | return nil 377 | } 378 | 379 | func (x *Types) GetBoolValue() *wrapperspb.BoolValue { 380 | if x != nil { 381 | return x.BoolValue 382 | } 383 | return nil 384 | } 385 | 386 | func (x *Types) GetStringValue() *wrapperspb.StringValue { 387 | if x != nil { 388 | return x.StringValue 389 | } 390 | return nil 391 | } 392 | 393 | func (x *Types) GetBytesValue() *wrapperspb.BytesValue { 394 | if x != nil { 395 | return x.BytesValue 396 | } 397 | return nil 398 | } 399 | 400 | type isTypes_Oneof interface { 401 | isTypes_Oneof() 402 | } 403 | 404 | type Types_One struct { 405 | One *OneOfOne `protobuf:"bytes,29,opt,name=one,proto3,oneof"` 406 | } 407 | 408 | type Types_Two struct { 409 | Two *OneOfTwo `protobuf:"bytes,30,opt,name=two,proto3,oneof"` 410 | } 411 | 412 | type Types_Three struct { 413 | Three *OneOfThree `protobuf:"bytes,31,opt,name=three,proto3,oneof"` 414 | } 415 | 416 | type Types_Four struct { 417 | Four Types_Enum `protobuf:"varint,32,opt,name=four,proto3,enum=tests.Types_Enum,oneof"` 418 | } 419 | 420 | func (*Types_One) isTypes_Oneof() {} 421 | 422 | func (*Types_Two) isTypes_Oneof() {} 423 | 424 | func (*Types_Three) isTypes_Oneof() {} 425 | 426 | func (*Types_Four) isTypes_Oneof() {} 427 | 428 | type Message struct { 429 | state protoimpl.MessageState 430 | sizeCache protoimpl.SizeCache 431 | unknownFields protoimpl.UnknownFields 432 | 433 | Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` 434 | } 435 | 436 | func (x *Message) Reset() { 437 | *x = Message{} 438 | if protoimpl.UnsafeEnabled { 439 | mi := &file_tests_pb_types_proto_msgTypes[1] 440 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 441 | ms.StoreMessageInfo(mi) 442 | } 443 | } 444 | 445 | func (x *Message) String() string { 446 | return protoimpl.X.MessageStringOf(x) 447 | } 448 | 449 | func (*Message) ProtoMessage() {} 450 | 451 | func (x *Message) ProtoReflect() protoreflect.Message { 452 | mi := &file_tests_pb_types_proto_msgTypes[1] 453 | if protoimpl.UnsafeEnabled && x != nil { 454 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 455 | if ms.LoadMessageInfo() == nil { 456 | ms.StoreMessageInfo(mi) 457 | } 458 | return ms 459 | } 460 | return mi.MessageOf(x) 461 | } 462 | 463 | // Deprecated: Use Message.ProtoReflect.Descriptor instead. 464 | func (*Message) Descriptor() ([]byte, []int) { 465 | return file_tests_pb_types_proto_rawDescGZIP(), []int{1} 466 | } 467 | 468 | func (x *Message) GetField() string { 469 | if x != nil { 470 | return x.Field 471 | } 472 | return "" 473 | } 474 | 475 | type OneOfOne struct { 476 | state protoimpl.MessageState 477 | sizeCache protoimpl.SizeCache 478 | unknownFields protoimpl.UnknownFields 479 | 480 | StringField string `protobuf:"bytes,1,opt,name=string_field,json=stringField,proto3" json:"string_field,omitempty"` 481 | } 482 | 483 | func (x *OneOfOne) Reset() { 484 | *x = OneOfOne{} 485 | if protoimpl.UnsafeEnabled { 486 | mi := &file_tests_pb_types_proto_msgTypes[2] 487 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 488 | ms.StoreMessageInfo(mi) 489 | } 490 | } 491 | 492 | func (x *OneOfOne) String() string { 493 | return protoimpl.X.MessageStringOf(x) 494 | } 495 | 496 | func (*OneOfOne) ProtoMessage() {} 497 | 498 | func (x *OneOfOne) ProtoReflect() protoreflect.Message { 499 | mi := &file_tests_pb_types_proto_msgTypes[2] 500 | if protoimpl.UnsafeEnabled && x != nil { 501 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 502 | if ms.LoadMessageInfo() == nil { 503 | ms.StoreMessageInfo(mi) 504 | } 505 | return ms 506 | } 507 | return mi.MessageOf(x) 508 | } 509 | 510 | // Deprecated: Use OneOfOne.ProtoReflect.Descriptor instead. 511 | func (*OneOfOne) Descriptor() ([]byte, []int) { 512 | return file_tests_pb_types_proto_rawDescGZIP(), []int{2} 513 | } 514 | 515 | func (x *OneOfOne) GetStringField() string { 516 | if x != nil { 517 | return x.StringField 518 | } 519 | return "" 520 | } 521 | 522 | type OneOfTwo struct { 523 | state protoimpl.MessageState 524 | sizeCache protoimpl.SizeCache 525 | unknownFields protoimpl.UnknownFields 526 | 527 | StringField string `protobuf:"bytes,1,opt,name=string_field,json=stringField,proto3" json:"string_field,omitempty"` 528 | } 529 | 530 | func (x *OneOfTwo) Reset() { 531 | *x = OneOfTwo{} 532 | if protoimpl.UnsafeEnabled { 533 | mi := &file_tests_pb_types_proto_msgTypes[3] 534 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 535 | ms.StoreMessageInfo(mi) 536 | } 537 | } 538 | 539 | func (x *OneOfTwo) String() string { 540 | return protoimpl.X.MessageStringOf(x) 541 | } 542 | 543 | func (*OneOfTwo) ProtoMessage() {} 544 | 545 | func (x *OneOfTwo) ProtoReflect() protoreflect.Message { 546 | mi := &file_tests_pb_types_proto_msgTypes[3] 547 | if protoimpl.UnsafeEnabled && x != nil { 548 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 549 | if ms.LoadMessageInfo() == nil { 550 | ms.StoreMessageInfo(mi) 551 | } 552 | return ms 553 | } 554 | return mi.MessageOf(x) 555 | } 556 | 557 | // Deprecated: Use OneOfTwo.ProtoReflect.Descriptor instead. 558 | func (*OneOfTwo) Descriptor() ([]byte, []int) { 559 | return file_tests_pb_types_proto_rawDescGZIP(), []int{3} 560 | } 561 | 562 | func (x *OneOfTwo) GetStringField() string { 563 | if x != nil { 564 | return x.StringField 565 | } 566 | return "" 567 | } 568 | 569 | type OneOfThree struct { 570 | state protoimpl.MessageState 571 | sizeCache protoimpl.SizeCache 572 | unknownFields protoimpl.UnknownFields 573 | 574 | StringField string `protobuf:"bytes,1,opt,name=string_field,json=stringField,proto3" json:"string_field,omitempty"` 575 | } 576 | 577 | func (x *OneOfThree) Reset() { 578 | *x = OneOfThree{} 579 | if protoimpl.UnsafeEnabled { 580 | mi := &file_tests_pb_types_proto_msgTypes[4] 581 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 582 | ms.StoreMessageInfo(mi) 583 | } 584 | } 585 | 586 | func (x *OneOfThree) String() string { 587 | return protoimpl.X.MessageStringOf(x) 588 | } 589 | 590 | func (*OneOfThree) ProtoMessage() {} 591 | 592 | func (x *OneOfThree) ProtoReflect() protoreflect.Message { 593 | mi := &file_tests_pb_types_proto_msgTypes[4] 594 | if protoimpl.UnsafeEnabled && x != nil { 595 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 596 | if ms.LoadMessageInfo() == nil { 597 | ms.StoreMessageInfo(mi) 598 | } 599 | return ms 600 | } 601 | return mi.MessageOf(x) 602 | } 603 | 604 | // Deprecated: Use OneOfThree.ProtoReflect.Descriptor instead. 605 | func (*OneOfThree) Descriptor() ([]byte, []int) { 606 | return file_tests_pb_types_proto_rawDescGZIP(), []int{4} 607 | } 608 | 609 | func (x *OneOfThree) GetStringField() string { 610 | if x != nil { 611 | return x.StringField 612 | } 613 | return "" 614 | } 615 | 616 | var File_tests_pb_types_proto protoreflect.FileDescriptor 617 | 618 | var file_tests_pb_types_proto_rawDesc = []byte{ 619 | 0x0a, 0x14, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x70, 0x62, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 620 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x74, 0x65, 0x73, 0x74, 0x73, 0x1a, 0x17, 0x64, 621 | 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 622 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 623 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 624 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 625 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 626 | 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 627 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 628 | 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x0c, 0x0a, 0x05, 0x54, 0x79, 0x70, 0x65, 629 | 0x73, 0x12, 0x1e, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 630 | 0x42, 0x08, 0x9a, 0x49, 0x05, 0x0d, 0x3d, 0x0a, 0xd7, 0x3e, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x61, 631 | 0x74, 0x12, 0x24, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 632 | 0x01, 0x42, 0x0c, 0x9a, 0x49, 0x09, 0x11, 0xe1, 0x7a, 0x14, 0xae, 0x47, 0xe1, 0xda, 0x3f, 0x52, 633 | 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 634 | 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x18, 0x2a, 0x52, 0x05, 0x69, 635 | 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 636 | 0x01, 0x28, 0x03, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x20, 0x2a, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x36, 637 | 0x34, 0x12, 0x1d, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 638 | 0x0d, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x28, 0x2a, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 639 | 0x12, 0x1d, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 640 | 0x42, 0x05, 0x9a, 0x49, 0x02, 0x30, 0x2a, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 641 | 0x1d, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x11, 0x42, 642 | 0x05, 0x9a, 0x49, 0x02, 0x38, 0x54, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1d, 643 | 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x12, 0x42, 0x05, 644 | 0x9a, 0x49, 0x02, 0x40, 0x54, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x22, 0x0a, 645 | 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x07, 0x42, 0x08, 646 | 0x9a, 0x49, 0x05, 0x4d, 0x2a, 0x00, 0x00, 0x00, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 647 | 0x32, 0x12, 0x26, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x0a, 0x20, 0x01, 648 | 0x28, 0x06, 0x42, 0x0c, 0x9a, 0x49, 0x09, 0x51, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 649 | 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x24, 0x0a, 0x08, 0x73, 0x66, 0x69, 650 | 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0f, 0x42, 0x08, 0x9a, 0x49, 0x05, 651 | 0x5d, 0x2a, 0x00, 0x00, 0x00, 0x52, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 652 | 0x28, 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 653 | 0x10, 0x42, 0x0c, 0x9a, 0x49, 0x09, 0x61, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 654 | 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 655 | 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x68, 0x01, 0x52, 0x04, 656 | 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0e, 657 | 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0x9a, 0x49, 0x04, 0x72, 0x02, 0x34, 0x32, 0x52, 0x06, 0x73, 658 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1d, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0f, 659 | 0x20, 0x01, 0x28, 0x0c, 0x42, 0x07, 0x9a, 0x49, 0x04, 0x7a, 0x02, 0x34, 0x32, 0x52, 0x05, 0x62, 660 | 0x79, 0x74, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x01, 661 | 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 662 | 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x06, 0x9a, 0x49, 0x03, 0x80, 0x01, 0x01, 0x52, 0x04, 0x65, 663 | 0x6e, 0x75, 0x6d, 0x12, 0x34, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 664 | 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x73, 665 | 0x73, 0x61, 0x67, 0x65, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 0x04, 0x08, 0x01, 0x10, 0x00, 666 | 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2f, 0x0a, 0x03, 0x6f, 0x6e, 0x65, 667 | 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x4f, 668 | 0x6e, 0x65, 0x4f, 0x66, 0x4f, 0x6e, 0x65, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 0x04, 0x08, 669 | 0x01, 0x10, 0x01, 0x48, 0x00, 0x52, 0x03, 0x6f, 0x6e, 0x65, 0x12, 0x2f, 0x0a, 0x03, 0x74, 0x77, 670 | 0x6f, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 671 | 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x54, 0x77, 0x6f, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 0x04, 672 | 0x08, 0x01, 0x10, 0x01, 0x48, 0x00, 0x52, 0x03, 0x74, 0x77, 0x6f, 0x12, 0x35, 0x0a, 0x05, 0x74, 673 | 0x68, 0x72, 0x65, 0x65, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 674 | 0x74, 0x73, 0x2e, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x54, 0x68, 0x72, 0x65, 0x65, 0x42, 0x0a, 0x9a, 675 | 0x49, 0x07, 0x8a, 0x01, 0x04, 0x08, 0x01, 0x10, 0x01, 0x48, 0x00, 0x52, 0x05, 0x74, 0x68, 0x72, 676 | 0x65, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x66, 0x6f, 0x75, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0e, 677 | 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x45, 678 | 0x6e, 0x75, 0x6d, 0x42, 0x06, 0x9a, 0x49, 0x03, 0x80, 0x01, 0x01, 0x48, 0x00, 0x52, 0x04, 0x66, 679 | 0x6f, 0x75, 0x72, 0x12, 0x3f, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 680 | 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 681 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 682 | 0x42, 0x08, 0x9a, 0x49, 0x05, 0xaa, 0x01, 0x02, 0x32, 0x64, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 683 | 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 684 | 0x70, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 685 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 686 | 0x61, 0x6d, 0x70, 0x42, 0x09, 0x9a, 0x49, 0x06, 0xb2, 0x01, 0x03, 0x6e, 0x6f, 0x77, 0x52, 0x09, 687 | 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x4d, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 688 | 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 689 | 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 690 | 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0c, 0x9a, 691 | 0x49, 0x09, 0x11, 0xe1, 0x7a, 0x14, 0xae, 0x47, 0xe1, 0xda, 0x3f, 0x52, 0x0b, 0x64, 0x6f, 0x75, 692 | 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 693 | 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 694 | 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 695 | 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0x9a, 0x49, 0x05, 0x0d, 696 | 0x3d, 0x0a, 0xd7, 0x3e, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 697 | 0x12, 0x43, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 698 | 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 699 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 700 | 0x75, 0x65, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x20, 0x2a, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 701 | 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 702 | 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 703 | 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 704 | 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x30, 0x2a, 705 | 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x43, 0x0a, 706 | 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x18, 0x20, 0x01, 707 | 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 708 | 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 709 | 0x05, 0x9a, 0x49, 0x02, 0x18, 0x2a, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 710 | 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 711 | 0x75, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 712 | 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 713 | 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x28, 0x2a, 0x52, 0x0b, 0x75, 714 | 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x40, 0x0a, 0x0a, 0x62, 0x6f, 715 | 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 716 | 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 717 | 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x68, 718 | 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x48, 0x0a, 0x0c, 719 | 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1b, 0x20, 0x01, 720 | 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 721 | 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 722 | 0x42, 0x07, 0x9a, 0x49, 0x04, 0x72, 0x02, 0x34, 0x32, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 723 | 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 724 | 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 725 | 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 726 | 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x9a, 0x49, 0x04, 0x7a, 0x02, 0x34, 727 | 0x32, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 728 | 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 729 | 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x57, 0x4f, 0x10, 730 | 0x02, 0x42, 0x0f, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x06, 0x9a, 0x49, 0x03, 0x74, 731 | 0x77, 0x6f, 0x22, 0x32, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x27, 0x0a, 732 | 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0x9a, 0x49, 733 | 0x0e, 0x72, 0x0c, 0x6c, 0x6f, 0x6e, 0x65, 0x6c, 0x79, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x52, 734 | 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x45, 0x0a, 0x08, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x4f, 735 | 0x6e, 0x65, 0x12, 0x34, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 736 | 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0x9a, 0x49, 0x0e, 0x72, 0x0c, 0x73, 737 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0b, 0x73, 0x74, 0x72, 738 | 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x03, 0xa0, 0x49, 0x01, 0x22, 0x40, 0x0a, 739 | 0x08, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x54, 0x77, 0x6f, 0x12, 0x34, 0x0a, 0x0c, 0x73, 0x74, 0x72, 740 | 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 741 | 0x11, 0x9a, 0x49, 0x0e, 0x72, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 742 | 0x6c, 0x64, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 743 | 0x47, 0x0a, 0x0a, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x54, 0x68, 0x72, 0x65, 0x65, 0x12, 0x34, 0x0a, 744 | 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 745 | 0x01, 0x28, 0x09, 0x42, 0x11, 0x9a, 0x49, 0x0e, 0x72, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 746 | 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 747 | 0x65, 0x6c, 0x64, 0x3a, 0x03, 0x98, 0x49, 0x01, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x6f, 0x2e, 0x6c, 748 | 0x69, 0x6e, 0x6b, 0x61, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 749 | 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x74, 750 | 0x65, 0x73, 0x74, 0x73, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 751 | 0x6f, 0x33, 752 | } 753 | 754 | var ( 755 | file_tests_pb_types_proto_rawDescOnce sync.Once 756 | file_tests_pb_types_proto_rawDescData = file_tests_pb_types_proto_rawDesc 757 | ) 758 | 759 | func file_tests_pb_types_proto_rawDescGZIP() []byte { 760 | file_tests_pb_types_proto_rawDescOnce.Do(func() { 761 | file_tests_pb_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_tests_pb_types_proto_rawDescData) 762 | }) 763 | return file_tests_pb_types_proto_rawDescData 764 | } 765 | 766 | var file_tests_pb_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) 767 | var file_tests_pb_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) 768 | var file_tests_pb_types_proto_goTypes = []interface{}{ 769 | (Types_Enum)(0), // 0: tests.Types.Enum 770 | (*Types)(nil), // 1: tests.Types 771 | (*Message)(nil), // 2: tests.Message 772 | (*OneOfOne)(nil), // 3: tests.OneOfOne 773 | (*OneOfTwo)(nil), // 4: tests.OneOfTwo 774 | (*OneOfThree)(nil), // 5: tests.OneOfThree 775 | (*durationpb.Duration)(nil), // 6: google.protobuf.Duration 776 | (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp 777 | (*wrapperspb.DoubleValue)(nil), // 8: google.protobuf.DoubleValue 778 | (*wrapperspb.FloatValue)(nil), // 9: google.protobuf.FloatValue 779 | (*wrapperspb.Int64Value)(nil), // 10: google.protobuf.Int64Value 780 | (*wrapperspb.UInt64Value)(nil), // 11: google.protobuf.UInt64Value 781 | (*wrapperspb.Int32Value)(nil), // 12: google.protobuf.Int32Value 782 | (*wrapperspb.UInt32Value)(nil), // 13: google.protobuf.UInt32Value 783 | (*wrapperspb.BoolValue)(nil), // 14: google.protobuf.BoolValue 784 | (*wrapperspb.StringValue)(nil), // 15: google.protobuf.StringValue 785 | (*wrapperspb.BytesValue)(nil), // 16: google.protobuf.BytesValue 786 | } 787 | var file_tests_pb_types_proto_depIdxs = []int32{ 788 | 0, // 0: tests.Types.enum:type_name -> tests.Types.Enum 789 | 2, // 1: tests.Types.message:type_name -> tests.Message 790 | 3, // 2: tests.Types.one:type_name -> tests.OneOfOne 791 | 4, // 3: tests.Types.two:type_name -> tests.OneOfTwo 792 | 5, // 4: tests.Types.three:type_name -> tests.OneOfThree 793 | 0, // 5: tests.Types.four:type_name -> tests.Types.Enum 794 | 6, // 6: tests.Types.duration:type_name -> google.protobuf.Duration 795 | 7, // 7: tests.Types.timestamp:type_name -> google.protobuf.Timestamp 796 | 8, // 8: tests.Types.double_value:type_name -> google.protobuf.DoubleValue 797 | 9, // 9: tests.Types.float_value:type_name -> google.protobuf.FloatValue 798 | 10, // 10: tests.Types.int64_value:type_name -> google.protobuf.Int64Value 799 | 11, // 11: tests.Types.uint64_value:type_name -> google.protobuf.UInt64Value 800 | 12, // 12: tests.Types.int32_value:type_name -> google.protobuf.Int32Value 801 | 13, // 13: tests.Types.uint32_value:type_name -> google.protobuf.UInt32Value 802 | 14, // 14: tests.Types.bool_value:type_name -> google.protobuf.BoolValue 803 | 15, // 15: tests.Types.string_value:type_name -> google.protobuf.StringValue 804 | 16, // 16: tests.Types.bytes_value:type_name -> google.protobuf.BytesValue 805 | 17, // [17:17] is the sub-list for method output_type 806 | 17, // [17:17] is the sub-list for method input_type 807 | 17, // [17:17] is the sub-list for extension type_name 808 | 17, // [17:17] is the sub-list for extension extendee 809 | 0, // [0:17] is the sub-list for field type_name 810 | } 811 | 812 | func init() { file_tests_pb_types_proto_init() } 813 | func file_tests_pb_types_proto_init() { 814 | if File_tests_pb_types_proto != nil { 815 | return 816 | } 817 | if !protoimpl.UnsafeEnabled { 818 | file_tests_pb_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 819 | switch v := v.(*Types); i { 820 | case 0: 821 | return &v.state 822 | case 1: 823 | return &v.sizeCache 824 | case 2: 825 | return &v.unknownFields 826 | default: 827 | return nil 828 | } 829 | } 830 | file_tests_pb_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 831 | switch v := v.(*Message); i { 832 | case 0: 833 | return &v.state 834 | case 1: 835 | return &v.sizeCache 836 | case 2: 837 | return &v.unknownFields 838 | default: 839 | return nil 840 | } 841 | } 842 | file_tests_pb_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 843 | switch v := v.(*OneOfOne); i { 844 | case 0: 845 | return &v.state 846 | case 1: 847 | return &v.sizeCache 848 | case 2: 849 | return &v.unknownFields 850 | default: 851 | return nil 852 | } 853 | } 854 | file_tests_pb_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { 855 | switch v := v.(*OneOfTwo); i { 856 | case 0: 857 | return &v.state 858 | case 1: 859 | return &v.sizeCache 860 | case 2: 861 | return &v.unknownFields 862 | default: 863 | return nil 864 | } 865 | } 866 | file_tests_pb_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { 867 | switch v := v.(*OneOfThree); i { 868 | case 0: 869 | return &v.state 870 | case 1: 871 | return &v.sizeCache 872 | case 2: 873 | return &v.unknownFields 874 | default: 875 | return nil 876 | } 877 | } 878 | } 879 | file_tests_pb_types_proto_msgTypes[0].OneofWrappers = []interface{}{ 880 | (*Types_One)(nil), 881 | (*Types_Two)(nil), 882 | (*Types_Three)(nil), 883 | (*Types_Four)(nil), 884 | } 885 | type x struct{} 886 | out := protoimpl.TypeBuilder{ 887 | File: protoimpl.DescBuilder{ 888 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 889 | RawDescriptor: file_tests_pb_types_proto_rawDesc, 890 | NumEnums: 1, 891 | NumMessages: 5, 892 | NumExtensions: 0, 893 | NumServices: 0, 894 | }, 895 | GoTypes: file_tests_pb_types_proto_goTypes, 896 | DependencyIndexes: file_tests_pb_types_proto_depIdxs, 897 | EnumInfos: file_tests_pb_types_proto_enumTypes, 898 | MessageInfos: file_tests_pb_types_proto_msgTypes, 899 | }.Build() 900 | File_tests_pb_types_proto = out.File 901 | file_tests_pb_types_proto_rawDesc = nil 902 | file_tests_pb_types_proto_goTypes = nil 903 | file_tests_pb_types_proto_depIdxs = nil 904 | } 905 | -------------------------------------------------------------------------------- /tests/pb/test.pb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Linka Cloud All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-go. DO NOT EDIT. 16 | // versions: 17 | // protoc-gen-go v1.33.0 18 | // protoc (unknown) 19 | // source: tests/pb/test.proto 20 | 21 | package pb 22 | 23 | import ( 24 | reflect "reflect" 25 | sync "sync" 26 | 27 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 28 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 29 | descriptorpb "google.golang.org/protobuf/types/descriptorpb" 30 | durationpb "google.golang.org/protobuf/types/known/durationpb" 31 | timestamppb "google.golang.org/protobuf/types/known/timestamppb" 32 | wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 33 | 34 | _ "go.linka.cloud/protoc-gen-defaults/defaults" 35 | ) 36 | 37 | const ( 38 | // Verify that this generated code is sufficiently up-to-date. 39 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 40 | // Verify that runtime/protoimpl is sufficiently up-to-date. 41 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 42 | ) 43 | 44 | type Test_Type int32 45 | 46 | const ( 47 | Test_NONE Test_Type = 0 48 | Test_ONE Test_Type = 1 49 | Test_TWO Test_Type = 2 50 | ) 51 | 52 | // Enum value maps for Test_Type. 53 | var ( 54 | Test_Type_name = map[int32]string{ 55 | 0: "NONE", 56 | 1: "ONE", 57 | 2: "TWO", 58 | } 59 | Test_Type_value = map[string]int32{ 60 | "NONE": 0, 61 | "ONE": 1, 62 | "TWO": 2, 63 | } 64 | ) 65 | 66 | func (x Test_Type) Enum() *Test_Type { 67 | p := new(Test_Type) 68 | *p = x 69 | return p 70 | } 71 | 72 | func (x Test_Type) String() string { 73 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) 74 | } 75 | 76 | func (Test_Type) Descriptor() protoreflect.EnumDescriptor { 77 | return file_tests_pb_test_proto_enumTypes[0].Descriptor() 78 | } 79 | 80 | func (Test_Type) Type() protoreflect.EnumType { 81 | return &file_tests_pb_test_proto_enumTypes[0] 82 | } 83 | 84 | func (x Test_Type) Number() protoreflect.EnumNumber { 85 | return protoreflect.EnumNumber(x) 86 | } 87 | 88 | // Deprecated: Use Test_Type.Descriptor instead. 89 | func (Test_Type) EnumDescriptor() ([]byte, []int) { 90 | return file_tests_pb_test_proto_rawDescGZIP(), []int{0, 0} 91 | } 92 | 93 | type TestOptional_Type int32 94 | 95 | const ( 96 | TestOptional_NONE TestOptional_Type = 0 97 | TestOptional_ONE TestOptional_Type = 1 98 | TestOptional_TWO TestOptional_Type = 2 99 | ) 100 | 101 | // Enum value maps for TestOptional_Type. 102 | var ( 103 | TestOptional_Type_name = map[int32]string{ 104 | 0: "NONE", 105 | 1: "ONE", 106 | 2: "TWO", 107 | } 108 | TestOptional_Type_value = map[string]int32{ 109 | "NONE": 0, 110 | "ONE": 1, 111 | "TWO": 2, 112 | } 113 | ) 114 | 115 | func (x TestOptional_Type) Enum() *TestOptional_Type { 116 | p := new(TestOptional_Type) 117 | *p = x 118 | return p 119 | } 120 | 121 | func (x TestOptional_Type) String() string { 122 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) 123 | } 124 | 125 | func (TestOptional_Type) Descriptor() protoreflect.EnumDescriptor { 126 | return file_tests_pb_test_proto_enumTypes[1].Descriptor() 127 | } 128 | 129 | func (TestOptional_Type) Type() protoreflect.EnumType { 130 | return &file_tests_pb_test_proto_enumTypes[1] 131 | } 132 | 133 | func (x TestOptional_Type) Number() protoreflect.EnumNumber { 134 | return protoreflect.EnumNumber(x) 135 | } 136 | 137 | // Deprecated: Use TestOptional_Type.Descriptor instead. 138 | func (TestOptional_Type) EnumDescriptor() ([]byte, []int) { 139 | return file_tests_pb_test_proto_rawDescGZIP(), []int{1, 0} 140 | } 141 | 142 | type TestUnexported_Type int32 143 | 144 | const ( 145 | TestUnexported_NONE TestUnexported_Type = 0 146 | TestUnexported_ONE TestUnexported_Type = 1 147 | TestUnexported_TWO TestUnexported_Type = 2 148 | ) 149 | 150 | // Enum value maps for TestUnexported_Type. 151 | var ( 152 | TestUnexported_Type_name = map[int32]string{ 153 | 0: "NONE", 154 | 1: "ONE", 155 | 2: "TWO", 156 | } 157 | TestUnexported_Type_value = map[string]int32{ 158 | "NONE": 0, 159 | "ONE": 1, 160 | "TWO": 2, 161 | } 162 | ) 163 | 164 | func (x TestUnexported_Type) Enum() *TestUnexported_Type { 165 | p := new(TestUnexported_Type) 166 | *p = x 167 | return p 168 | } 169 | 170 | func (x TestUnexported_Type) String() string { 171 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) 172 | } 173 | 174 | func (TestUnexported_Type) Descriptor() protoreflect.EnumDescriptor { 175 | return file_tests_pb_test_proto_enumTypes[2].Descriptor() 176 | } 177 | 178 | func (TestUnexported_Type) Type() protoreflect.EnumType { 179 | return &file_tests_pb_test_proto_enumTypes[2] 180 | } 181 | 182 | func (x TestUnexported_Type) Number() protoreflect.EnumNumber { 183 | return protoreflect.EnumNumber(x) 184 | } 185 | 186 | // Deprecated: Use TestUnexported_Type.Descriptor instead. 187 | func (TestUnexported_Type) EnumDescriptor() ([]byte, []int) { 188 | return file_tests_pb_test_proto_rawDescGZIP(), []int{2, 0} 189 | } 190 | 191 | type Test struct { 192 | state protoimpl.MessageState 193 | sizeCache protoimpl.SizeCache 194 | unknownFields protoimpl.UnknownFields 195 | 196 | StringField string `protobuf:"bytes,1,opt,name=string_field,json=stringField,proto3" json:"string_field,omitempty"` 197 | NumberField int64 `protobuf:"varint,2,opt,name=number_field,json=numberField,proto3" json:"number_field,omitempty"` 198 | BoolField bool `protobuf:"varint,3,opt,name=bool_field,json=boolField,proto3" json:"bool_field,omitempty"` 199 | EnumField Test_Type `protobuf:"varint,4,opt,name=enum_field,json=enumField,proto3,enum=tests.Test_Type" json:"enum_field,omitempty"` 200 | MessageField *Test `protobuf:"bytes,5,opt,name=message_field,json=messageField,proto3" json:"message_field,omitempty"` 201 | RepeatedStringField []string `protobuf:"bytes,6,rep,name=repeated_string_field,json=repeatedStringField,proto3" json:"repeated_string_field,omitempty"` 202 | RepeatedMessageField []Test_Type `protobuf:"varint,7,rep,packed,name=repeated_message_field,json=repeatedMessageField,proto3,enum=tests.Test_Type" json:"repeated_message_field,omitempty"` 203 | NumberValueField *wrapperspb.Int64Value `protobuf:"bytes,8,opt,name=number_value_field,json=numberValueField,proto3" json:"number_value_field,omitempty"` 204 | StringValueField *wrapperspb.StringValue `protobuf:"bytes,9,opt,name=string_value_field,json=stringValueField,proto3" json:"string_value_field,omitempty"` 205 | BoolValueField *wrapperspb.BoolValue `protobuf:"bytes,10,opt,name=bool_value_field,json=boolValueField,proto3" json:"bool_value_field,omitempty"` 206 | TimeValueField *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=time_value_field,json=timeValueField,proto3" json:"time_value_field,omitempty"` 207 | DurationValueField *durationpb.Duration `protobuf:"bytes,12,opt,name=duration_value_field,json=durationValueField,proto3" json:"duration_value_field,omitempty"` 208 | // Types that are assignable to Oneof: 209 | // 210 | // *Test_One 211 | // *Test_Two 212 | // *Test_Three 213 | // *Test_Four 214 | Oneof isTest_Oneof `protobuf_oneof:"oneof"` 215 | Descriptor_ *descriptorpb.DescriptorProto `protobuf:"bytes,17,opt,name=descriptor,proto3" json:"descriptor,omitempty"` 216 | TimeValueFieldWithDefault *timestamppb.Timestamp `protobuf:"bytes,18,opt,name=time_value_field_with_default,json=timeValueFieldWithDefault,proto3" json:"time_value_field_with_default,omitempty"` 217 | Bytes []byte `protobuf:"bytes,19,opt,name=bytes,proto3" json:"bytes,omitempty"` 218 | } 219 | 220 | func (x *Test) Reset() { 221 | *x = Test{} 222 | if protoimpl.UnsafeEnabled { 223 | mi := &file_tests_pb_test_proto_msgTypes[0] 224 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 225 | ms.StoreMessageInfo(mi) 226 | } 227 | } 228 | 229 | func (x *Test) String() string { 230 | return protoimpl.X.MessageStringOf(x) 231 | } 232 | 233 | func (*Test) ProtoMessage() {} 234 | 235 | func (x *Test) ProtoReflect() protoreflect.Message { 236 | mi := &file_tests_pb_test_proto_msgTypes[0] 237 | if protoimpl.UnsafeEnabled && x != nil { 238 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 239 | if ms.LoadMessageInfo() == nil { 240 | ms.StoreMessageInfo(mi) 241 | } 242 | return ms 243 | } 244 | return mi.MessageOf(x) 245 | } 246 | 247 | // Deprecated: Use Test.ProtoReflect.Descriptor instead. 248 | func (*Test) Descriptor() ([]byte, []int) { 249 | return file_tests_pb_test_proto_rawDescGZIP(), []int{0} 250 | } 251 | 252 | func (x *Test) GetStringField() string { 253 | if x != nil { 254 | return x.StringField 255 | } 256 | return "" 257 | } 258 | 259 | func (x *Test) GetNumberField() int64 { 260 | if x != nil { 261 | return x.NumberField 262 | } 263 | return 0 264 | } 265 | 266 | func (x *Test) GetBoolField() bool { 267 | if x != nil { 268 | return x.BoolField 269 | } 270 | return false 271 | } 272 | 273 | func (x *Test) GetEnumField() Test_Type { 274 | if x != nil { 275 | return x.EnumField 276 | } 277 | return Test_NONE 278 | } 279 | 280 | func (x *Test) GetMessageField() *Test { 281 | if x != nil { 282 | return x.MessageField 283 | } 284 | return nil 285 | } 286 | 287 | func (x *Test) GetRepeatedStringField() []string { 288 | if x != nil { 289 | return x.RepeatedStringField 290 | } 291 | return nil 292 | } 293 | 294 | func (x *Test) GetRepeatedMessageField() []Test_Type { 295 | if x != nil { 296 | return x.RepeatedMessageField 297 | } 298 | return nil 299 | } 300 | 301 | func (x *Test) GetNumberValueField() *wrapperspb.Int64Value { 302 | if x != nil { 303 | return x.NumberValueField 304 | } 305 | return nil 306 | } 307 | 308 | func (x *Test) GetStringValueField() *wrapperspb.StringValue { 309 | if x != nil { 310 | return x.StringValueField 311 | } 312 | return nil 313 | } 314 | 315 | func (x *Test) GetBoolValueField() *wrapperspb.BoolValue { 316 | if x != nil { 317 | return x.BoolValueField 318 | } 319 | return nil 320 | } 321 | 322 | func (x *Test) GetTimeValueField() *timestamppb.Timestamp { 323 | if x != nil { 324 | return x.TimeValueField 325 | } 326 | return nil 327 | } 328 | 329 | func (x *Test) GetDurationValueField() *durationpb.Duration { 330 | if x != nil { 331 | return x.DurationValueField 332 | } 333 | return nil 334 | } 335 | 336 | func (m *Test) GetOneof() isTest_Oneof { 337 | if m != nil { 338 | return m.Oneof 339 | } 340 | return nil 341 | } 342 | 343 | func (x *Test) GetOne() *OneOfOne { 344 | if x, ok := x.GetOneof().(*Test_One); ok { 345 | return x.One 346 | } 347 | return nil 348 | } 349 | 350 | func (x *Test) GetTwo() *OneOfTwo { 351 | if x, ok := x.GetOneof().(*Test_Two); ok { 352 | return x.Two 353 | } 354 | return nil 355 | } 356 | 357 | func (x *Test) GetThree() *OneOfThree { 358 | if x, ok := x.GetOneof().(*Test_Three); ok { 359 | return x.Three 360 | } 361 | return nil 362 | } 363 | 364 | func (x *Test) GetFour() Test_Type { 365 | if x, ok := x.GetOneof().(*Test_Four); ok { 366 | return x.Four 367 | } 368 | return Test_NONE 369 | } 370 | 371 | func (x *Test) GetDescriptor_() *descriptorpb.DescriptorProto { 372 | if x != nil { 373 | return x.Descriptor_ 374 | } 375 | return nil 376 | } 377 | 378 | func (x *Test) GetTimeValueFieldWithDefault() *timestamppb.Timestamp { 379 | if x != nil { 380 | return x.TimeValueFieldWithDefault 381 | } 382 | return nil 383 | } 384 | 385 | func (x *Test) GetBytes() []byte { 386 | if x != nil { 387 | return x.Bytes 388 | } 389 | return nil 390 | } 391 | 392 | type isTest_Oneof interface { 393 | isTest_Oneof() 394 | } 395 | 396 | type Test_One struct { 397 | One *OneOfOne `protobuf:"bytes,13,opt,name=one,proto3,oneof"` 398 | } 399 | 400 | type Test_Two struct { 401 | Two *OneOfTwo `protobuf:"bytes,14,opt,name=two,proto3,oneof"` 402 | } 403 | 404 | type Test_Three struct { 405 | Three *OneOfThree `protobuf:"bytes,15,opt,name=three,proto3,oneof"` 406 | } 407 | 408 | type Test_Four struct { 409 | Four Test_Type `protobuf:"varint,16,opt,name=four,proto3,enum=tests.Test_Type,oneof"` 410 | } 411 | 412 | func (*Test_One) isTest_Oneof() {} 413 | 414 | func (*Test_Two) isTest_Oneof() {} 415 | 416 | func (*Test_Three) isTest_Oneof() {} 417 | 418 | func (*Test_Four) isTest_Oneof() {} 419 | 420 | type TestOptional struct { 421 | state protoimpl.MessageState 422 | sizeCache protoimpl.SizeCache 423 | unknownFields protoimpl.UnknownFields 424 | 425 | StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField,proto3,oneof" json:"string_field,omitempty"` 426 | NumberField *int64 `protobuf:"varint,2,opt,name=number_field,json=numberField,proto3,oneof" json:"number_field,omitempty"` 427 | BoolField *bool `protobuf:"varint,3,opt,name=bool_field,json=boolField,proto3,oneof" json:"bool_field,omitempty"` 428 | EnumField *TestOptional_Type `protobuf:"varint,4,opt,name=enum_field,json=enumField,proto3,enum=tests.TestOptional_Type,oneof" json:"enum_field,omitempty"` 429 | } 430 | 431 | func (x *TestOptional) Reset() { 432 | *x = TestOptional{} 433 | if protoimpl.UnsafeEnabled { 434 | mi := &file_tests_pb_test_proto_msgTypes[1] 435 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 436 | ms.StoreMessageInfo(mi) 437 | } 438 | } 439 | 440 | func (x *TestOptional) String() string { 441 | return protoimpl.X.MessageStringOf(x) 442 | } 443 | 444 | func (*TestOptional) ProtoMessage() {} 445 | 446 | func (x *TestOptional) ProtoReflect() protoreflect.Message { 447 | mi := &file_tests_pb_test_proto_msgTypes[1] 448 | if protoimpl.UnsafeEnabled && x != nil { 449 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 450 | if ms.LoadMessageInfo() == nil { 451 | ms.StoreMessageInfo(mi) 452 | } 453 | return ms 454 | } 455 | return mi.MessageOf(x) 456 | } 457 | 458 | // Deprecated: Use TestOptional.ProtoReflect.Descriptor instead. 459 | func (*TestOptional) Descriptor() ([]byte, []int) { 460 | return file_tests_pb_test_proto_rawDescGZIP(), []int{1} 461 | } 462 | 463 | func (x *TestOptional) GetStringField() string { 464 | if x != nil && x.StringField != nil { 465 | return *x.StringField 466 | } 467 | return "" 468 | } 469 | 470 | func (x *TestOptional) GetNumberField() int64 { 471 | if x != nil && x.NumberField != nil { 472 | return *x.NumberField 473 | } 474 | return 0 475 | } 476 | 477 | func (x *TestOptional) GetBoolField() bool { 478 | if x != nil && x.BoolField != nil { 479 | return *x.BoolField 480 | } 481 | return false 482 | } 483 | 484 | func (x *TestOptional) GetEnumField() TestOptional_Type { 485 | if x != nil && x.EnumField != nil { 486 | return *x.EnumField 487 | } 488 | return TestOptional_NONE 489 | } 490 | 491 | type TestUnexported struct { 492 | state protoimpl.MessageState 493 | sizeCache protoimpl.SizeCache 494 | unknownFields protoimpl.UnknownFields 495 | 496 | StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField,proto3,oneof" json:"string_field,omitempty"` 497 | NumberField *int64 `protobuf:"varint,2,opt,name=number_field,json=numberField,proto3,oneof" json:"number_field,omitempty"` 498 | BoolField *bool `protobuf:"varint,3,opt,name=bool_field,json=boolField,proto3,oneof" json:"bool_field,omitempty"` 499 | EnumField *TestUnexported_Type `protobuf:"varint,4,opt,name=enum_field,json=enumField,proto3,enum=tests.TestUnexported_Type,oneof" json:"enum_field,omitempty"` 500 | } 501 | 502 | func (x *TestUnexported) Reset() { 503 | *x = TestUnexported{} 504 | if protoimpl.UnsafeEnabled { 505 | mi := &file_tests_pb_test_proto_msgTypes[2] 506 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 507 | ms.StoreMessageInfo(mi) 508 | } 509 | } 510 | 511 | func (x *TestUnexported) String() string { 512 | return protoimpl.X.MessageStringOf(x) 513 | } 514 | 515 | func (*TestUnexported) ProtoMessage() {} 516 | 517 | func (x *TestUnexported) ProtoReflect() protoreflect.Message { 518 | mi := &file_tests_pb_test_proto_msgTypes[2] 519 | if protoimpl.UnsafeEnabled && x != nil { 520 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 521 | if ms.LoadMessageInfo() == nil { 522 | ms.StoreMessageInfo(mi) 523 | } 524 | return ms 525 | } 526 | return mi.MessageOf(x) 527 | } 528 | 529 | // Deprecated: Use TestUnexported.ProtoReflect.Descriptor instead. 530 | func (*TestUnexported) Descriptor() ([]byte, []int) { 531 | return file_tests_pb_test_proto_rawDescGZIP(), []int{2} 532 | } 533 | 534 | func (x *TestUnexported) GetStringField() string { 535 | if x != nil && x.StringField != nil { 536 | return *x.StringField 537 | } 538 | return "" 539 | } 540 | 541 | func (x *TestUnexported) GetNumberField() int64 { 542 | if x != nil && x.NumberField != nil { 543 | return *x.NumberField 544 | } 545 | return 0 546 | } 547 | 548 | func (x *TestUnexported) GetBoolField() bool { 549 | if x != nil && x.BoolField != nil { 550 | return *x.BoolField 551 | } 552 | return false 553 | } 554 | 555 | func (x *TestUnexported) GetEnumField() TestUnexported_Type { 556 | if x != nil && x.EnumField != nil { 557 | return *x.EnumField 558 | } 559 | return TestUnexported_NONE 560 | } 561 | 562 | var File_tests_pb_test_proto protoreflect.FileDescriptor 563 | 564 | var file_tests_pb_test_proto_rawDesc = []byte{ 565 | 0x0a, 0x13, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x70, 0x62, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 566 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x74, 0x65, 0x73, 0x74, 0x73, 0x1a, 0x17, 0x64, 0x65, 567 | 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 568 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 569 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 570 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 571 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 572 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 573 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 574 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 575 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 576 | 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 577 | 0x70, 0x62, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 578 | 0x0a, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 579 | 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0x9a, 580 | 0x49, 0x0e, 0x72, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 581 | 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x28, 0x0a, 582 | 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 583 | 0x01, 0x28, 0x03, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x20, 0x2a, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 584 | 0x65, 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x24, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 585 | 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x05, 0x9a, 0x49, 0x02, 586 | 0x68, 0x01, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x37, 0x0a, 587 | 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 588 | 0x0e, 0x32, 0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x54, 589 | 0x79, 0x70, 0x65, 0x42, 0x06, 0x9a, 0x49, 0x03, 0x80, 0x01, 0x02, 0x52, 0x09, 0x65, 0x6e, 0x75, 590 | 0x6d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3a, 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 591 | 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 592 | 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x42, 0x08, 0x9a, 0x49, 0x05, 0x8a, 593 | 0x01, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x69, 0x65, 594 | 0x6c, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 595 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, 596 | 0x09, 0x52, 0x13, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 597 | 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x46, 0x0a, 0x16, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 598 | 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 599 | 0x18, 0x07, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 600 | 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x14, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 601 | 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x50, 602 | 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 603 | 0x69, 0x65, 0x6c, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 604 | 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 605 | 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x20, 0x2b, 0x52, 0x10, 606 | 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 607 | 0x12, 0x5d, 0x0a, 0x12, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 608 | 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 609 | 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 610 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x11, 0x9a, 0x49, 0x0e, 0x72, 611 | 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x10, 0x73, 612 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 613 | 0x4b, 0x0a, 0x10, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x69, 614 | 0x65, 0x6c, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 615 | 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 616 | 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x68, 0x00, 0x52, 0x0e, 0x62, 0x6f, 617 | 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x4f, 0x0a, 0x10, 618 | 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 619 | 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 620 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 621 | 0x6d, 0x70, 0x42, 0x09, 0x9a, 0x49, 0x06, 0xb2, 0x01, 0x03, 0x6e, 0x6f, 0x77, 0x52, 0x0e, 0x74, 622 | 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x56, 0x0a, 623 | 0x14, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 624 | 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 625 | 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 626 | 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x9a, 0x49, 0x06, 0xaa, 0x01, 0x03, 0x34, 0x32, 627 | 0x77, 0x52, 0x12, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 628 | 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2f, 0x0a, 0x03, 0x6f, 0x6e, 0x65, 0x18, 0x0d, 0x20, 0x01, 629 | 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 630 | 0x4f, 0x6e, 0x65, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 0x04, 0x08, 0x01, 0x10, 0x01, 0x48, 631 | 0x00, 0x52, 0x03, 0x6f, 0x6e, 0x65, 0x12, 0x2f, 0x0a, 0x03, 0x74, 0x77, 0x6f, 0x18, 0x0e, 0x20, 632 | 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x4f, 0x6e, 0x65, 0x4f, 633 | 0x66, 0x54, 0x77, 0x6f, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 0x04, 0x08, 0x01, 0x10, 0x01, 634 | 0x48, 0x00, 0x52, 0x03, 0x74, 0x77, 0x6f, 0x12, 0x35, 0x0a, 0x05, 0x74, 0x68, 0x72, 0x65, 0x65, 635 | 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x4f, 636 | 0x6e, 0x65, 0x4f, 0x66, 0x54, 0x68, 0x72, 0x65, 0x65, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 637 | 0x04, 0x08, 0x01, 0x10, 0x01, 0x48, 0x00, 0x52, 0x05, 0x74, 0x68, 0x72, 0x65, 0x65, 0x12, 0x2e, 638 | 0x0a, 0x04, 0x66, 0x6f, 0x75, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x74, 639 | 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 640 | 0x9a, 0x49, 0x03, 0x80, 0x01, 0x01, 0x48, 0x00, 0x52, 0x04, 0x66, 0x6f, 0x75, 0x72, 0x12, 0x4c, 641 | 0x0a, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x18, 0x11, 0x20, 0x01, 642 | 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 643 | 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 644 | 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x0a, 0x9a, 0x49, 0x07, 0x8a, 0x01, 0x04, 0x08, 0x01, 0x10, 0x01, 645 | 0x52, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x78, 0x0a, 0x1d, 646 | 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 647 | 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x12, 0x20, 648 | 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 649 | 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 650 | 0x1a, 0x9a, 0x49, 0x17, 0xb2, 0x01, 0x14, 0x31, 0x39, 0x35, 0x32, 0x2d, 0x30, 0x33, 0x2d, 0x31, 651 | 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x52, 0x19, 0x74, 0x69, 0x6d, 652 | 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x57, 0x69, 0x74, 0x68, 0x44, 653 | 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 654 | 0x13, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x07, 0x9a, 0x49, 0x04, 0x7a, 0x02, 0x3f, 0x3f, 0x52, 0x05, 655 | 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x22, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 656 | 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 0x01, 657 | 0x12, 0x07, 0x0a, 0x03, 0x54, 0x57, 0x4f, 0x10, 0x02, 0x42, 0x0f, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 658 | 0x6f, 0x66, 0x12, 0x06, 0x9a, 0x49, 0x03, 0x74, 0x77, 0x6f, 0x22, 0xcd, 0x02, 0x0a, 0x0c, 0x54, 659 | 0x65, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x39, 0x0a, 0x0c, 0x73, 660 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 661 | 0x09, 0x42, 0x11, 0x9a, 0x49, 0x0e, 0x72, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 662 | 0x69, 0x65, 0x6c, 0x64, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 663 | 0x65, 0x6c, 0x64, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 664 | 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x05, 0x9a, 0x49, 665 | 0x02, 0x20, 0x2a, 0x48, 0x01, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x46, 0x69, 0x65, 666 | 0x6c, 0x64, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x66, 0x69, 667 | 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x05, 0x9a, 0x49, 0x02, 0x68, 0x01, 668 | 0x48, 0x02, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x88, 0x01, 0x01, 669 | 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x04, 670 | 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 0x65, 0x73, 671 | 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 672 | 0x9a, 0x49, 0x03, 0x80, 0x01, 0x02, 0x48, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x46, 0x69, 673 | 0x65, 0x6c, 0x64, 0x88, 0x01, 0x01, 0x22, 0x22, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 674 | 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 675 | 0x01, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x57, 0x4f, 0x10, 0x02, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x73, 676 | 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 677 | 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 678 | 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 679 | 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0xd6, 0x02, 0x0a, 0x0e, 0x54, 680 | 0x65, 0x73, 0x74, 0x55, 0x6e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x12, 0x39, 0x0a, 681 | 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 682 | 0x01, 0x28, 0x09, 0x42, 0x11, 0x9a, 0x49, 0x0e, 0x72, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 683 | 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 684 | 0x46, 0x69, 0x65, 0x6c, 0x64, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 685 | 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x05, 686 | 0x9a, 0x49, 0x02, 0x20, 0x2a, 0x48, 0x01, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x46, 687 | 0x69, 0x65, 0x6c, 0x64, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 688 | 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x05, 0x9a, 0x49, 0x02, 689 | 0x68, 0x01, 0x48, 0x02, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x88, 690 | 0x01, 0x01, 0x12, 0x46, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 691 | 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x54, 692 | 0x65, 0x73, 0x74, 0x55, 0x6e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x2e, 0x54, 0x79, 693 | 0x70, 0x65, 0x42, 0x06, 0x9a, 0x49, 0x03, 0x80, 0x01, 0x02, 0x48, 0x03, 0x52, 0x09, 0x65, 0x6e, 694 | 0x75, 0x6d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x88, 0x01, 0x01, 0x22, 0x22, 0x0a, 0x04, 0x54, 0x79, 695 | 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 696 | 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x57, 0x4f, 0x10, 0x02, 0x3a, 0x03, 697 | 0xa8, 0x49, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 698 | 0x69, 0x65, 0x6c, 0x64, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 699 | 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x66, 700 | 0x69, 0x65, 0x6c, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x66, 0x69, 701 | 0x65, 0x6c, 0x64, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x6f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x2e, 702 | 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 703 | 0x2d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 704 | 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 705 | } 706 | 707 | var ( 708 | file_tests_pb_test_proto_rawDescOnce sync.Once 709 | file_tests_pb_test_proto_rawDescData = file_tests_pb_test_proto_rawDesc 710 | ) 711 | 712 | func file_tests_pb_test_proto_rawDescGZIP() []byte { 713 | file_tests_pb_test_proto_rawDescOnce.Do(func() { 714 | file_tests_pb_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_tests_pb_test_proto_rawDescData) 715 | }) 716 | return file_tests_pb_test_proto_rawDescData 717 | } 718 | 719 | var file_tests_pb_test_proto_enumTypes = make([]protoimpl.EnumInfo, 3) 720 | var file_tests_pb_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3) 721 | var file_tests_pb_test_proto_goTypes = []interface{}{ 722 | (Test_Type)(0), // 0: tests.Test.Type 723 | (TestOptional_Type)(0), // 1: tests.TestOptional.Type 724 | (TestUnexported_Type)(0), // 2: tests.TestUnexported.Type 725 | (*Test)(nil), // 3: tests.Test 726 | (*TestOptional)(nil), // 4: tests.TestOptional 727 | (*TestUnexported)(nil), // 5: tests.TestUnexported 728 | (*wrapperspb.Int64Value)(nil), // 6: google.protobuf.Int64Value 729 | (*wrapperspb.StringValue)(nil), // 7: google.protobuf.StringValue 730 | (*wrapperspb.BoolValue)(nil), // 8: google.protobuf.BoolValue 731 | (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp 732 | (*durationpb.Duration)(nil), // 10: google.protobuf.Duration 733 | (*OneOfOne)(nil), // 11: tests.OneOfOne 734 | (*OneOfTwo)(nil), // 12: tests.OneOfTwo 735 | (*OneOfThree)(nil), // 13: tests.OneOfThree 736 | (*descriptorpb.DescriptorProto)(nil), // 14: google.protobuf.DescriptorProto 737 | } 738 | var file_tests_pb_test_proto_depIdxs = []int32{ 739 | 0, // 0: tests.Test.enum_field:type_name -> tests.Test.Type 740 | 3, // 1: tests.Test.message_field:type_name -> tests.Test 741 | 0, // 2: tests.Test.repeated_message_field:type_name -> tests.Test.Type 742 | 6, // 3: tests.Test.number_value_field:type_name -> google.protobuf.Int64Value 743 | 7, // 4: tests.Test.string_value_field:type_name -> google.protobuf.StringValue 744 | 8, // 5: tests.Test.bool_value_field:type_name -> google.protobuf.BoolValue 745 | 9, // 6: tests.Test.time_value_field:type_name -> google.protobuf.Timestamp 746 | 10, // 7: tests.Test.duration_value_field:type_name -> google.protobuf.Duration 747 | 11, // 8: tests.Test.one:type_name -> tests.OneOfOne 748 | 12, // 9: tests.Test.two:type_name -> tests.OneOfTwo 749 | 13, // 10: tests.Test.three:type_name -> tests.OneOfThree 750 | 0, // 11: tests.Test.four:type_name -> tests.Test.Type 751 | 14, // 12: tests.Test.descriptor:type_name -> google.protobuf.DescriptorProto 752 | 9, // 13: tests.Test.time_value_field_with_default:type_name -> google.protobuf.Timestamp 753 | 1, // 14: tests.TestOptional.enum_field:type_name -> tests.TestOptional.Type 754 | 2, // 15: tests.TestUnexported.enum_field:type_name -> tests.TestUnexported.Type 755 | 16, // [16:16] is the sub-list for method output_type 756 | 16, // [16:16] is the sub-list for method input_type 757 | 16, // [16:16] is the sub-list for extension type_name 758 | 16, // [16:16] is the sub-list for extension extendee 759 | 0, // [0:16] is the sub-list for field type_name 760 | } 761 | 762 | func init() { file_tests_pb_test_proto_init() } 763 | func file_tests_pb_test_proto_init() { 764 | if File_tests_pb_test_proto != nil { 765 | return 766 | } 767 | file_tests_pb_types_proto_init() 768 | if !protoimpl.UnsafeEnabled { 769 | file_tests_pb_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 770 | switch v := v.(*Test); i { 771 | case 0: 772 | return &v.state 773 | case 1: 774 | return &v.sizeCache 775 | case 2: 776 | return &v.unknownFields 777 | default: 778 | return nil 779 | } 780 | } 781 | file_tests_pb_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 782 | switch v := v.(*TestOptional); i { 783 | case 0: 784 | return &v.state 785 | case 1: 786 | return &v.sizeCache 787 | case 2: 788 | return &v.unknownFields 789 | default: 790 | return nil 791 | } 792 | } 793 | file_tests_pb_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 794 | switch v := v.(*TestUnexported); i { 795 | case 0: 796 | return &v.state 797 | case 1: 798 | return &v.sizeCache 799 | case 2: 800 | return &v.unknownFields 801 | default: 802 | return nil 803 | } 804 | } 805 | } 806 | file_tests_pb_test_proto_msgTypes[0].OneofWrappers = []interface{}{ 807 | (*Test_One)(nil), 808 | (*Test_Two)(nil), 809 | (*Test_Three)(nil), 810 | (*Test_Four)(nil), 811 | } 812 | file_tests_pb_test_proto_msgTypes[1].OneofWrappers = []interface{}{} 813 | file_tests_pb_test_proto_msgTypes[2].OneofWrappers = []interface{}{} 814 | type x struct{} 815 | out := protoimpl.TypeBuilder{ 816 | File: protoimpl.DescBuilder{ 817 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 818 | RawDescriptor: file_tests_pb_test_proto_rawDesc, 819 | NumEnums: 3, 820 | NumMessages: 3, 821 | NumExtensions: 0, 822 | NumServices: 0, 823 | }, 824 | GoTypes: file_tests_pb_test_proto_goTypes, 825 | DependencyIndexes: file_tests_pb_test_proto_depIdxs, 826 | EnumInfos: file_tests_pb_test_proto_enumTypes, 827 | MessageInfos: file_tests_pb_test_proto_msgTypes, 828 | }.Build() 829 | File_tests_pb_test_proto = out.File 830 | file_tests_pb_test_proto_rawDesc = nil 831 | file_tests_pb_test_proto_goTypes = nil 832 | file_tests_pb_test_proto_depIdxs = nil 833 | } 834 | --------------------------------------------------------------------------------