From 542f3a1da4abc12084e590f38753de0de633ebcd Mon Sep 17 00:00:00 2001 From: Shivam Rathore Date: Wed, 5 Aug 2020 20:12:58 +0530 Subject: [PATCH] solution for the issue: lyft/protoc-gen-star#64 --- check.proto | 4 ++++ main.go | 2 +- sample.txt | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/check.proto b/check.proto index 97586e6..19efea6 100644 --- a/check.proto +++ b/check.proto @@ -6,6 +6,10 @@ import "type.proto"; message Check { string field_1 = 1 [(main.rule1).type.one = "rule1.type.one", (main.rule1).type.two = "rule1.type.two"]; + // issue string field_2 = 2 [(main.rule2).type.one = "rule2.type.one", (main.rule2).type.two = "rule2.type.two"]; string field_3 = 3 [(main.rule2).type.two = "rule2.type.two", (main.rule2).type.one = "rule2.type.one"]; + // solution + string field_4 = 4 [(main.rule2).type = {one: "rule2.type.one" two: "rule2.type.two"}]; + string field_5 = 5 [(main.rule2).type = {two: "rule2.type.two" one: "rule2.type.one"}]; } diff --git a/main.go b/main.go index 65cb951..d6db376 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( pgs "github.com/lyft/protoc-gen-star" ) -//TODO: GO111MODULE=on go build -o bin/protoc-gen-sample +//go:generate go build -o bin/protoc-gen-sample //go:generate protoc -I . type.proto --go_out=plugins=grpc:. //go:generate protoc -I . check.proto --plugin=bin/protoc-gen-sample --sample_out=:. diff --git a/sample.txt b/sample.txt index 8bfd251..a1a1384 100644 --- a/sample.txt +++ b/sample.txt @@ -1,3 +1,5 @@ field_1 one:"rule1.type.one" two:"rule1.type.two" field_2 two:"rule2.type.two" field_3 one:"rule2.type.one" +field_4 one:"rule2.type.one" two:"rule2.type.two" +field_5 one:"rule2.type.one" two:"rule2.type.two"