From a13e6ce5e7d8b36cd4bf3dca52d8b0e95aac4bda Mon Sep 17 00:00:00 2001 From: Vaidehi Duraphe Date: Thu, 22 Aug 2024 16:55:21 -0700 Subject: [PATCH 1/5] editions support rough --- .DS_Store | Bin 0 -> 14340 bytes generator.go | 3 ++ go.mod | 2 +- go.sum | 5 +++ init_option.go | 18 +++++++++++ persister.go | 13 ++++++++ protoc-gen-debug/main.go | 8 ++++- testdata/protos/kitchen/fridge.proto | 44 +++++++++++++++++++++++++++ workflow.go | 6 ++++ 9 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 .DS_Store create mode 100644 testdata/protos/kitchen/fridge.proto diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4b96819a0e05692bffc3ea15780fa6ba7638e676 GIT binary patch literal 14340 zcmeHO!EPKy5UsI|y|#DlwG)(FKzrbd6>gl+65B|TLLw2kve>(}v9j@?^*SLJ9Zm&PJeJiHivBJw~)S~%Hu z+qnEJ(qn55e$R96Sj3Y8=OdiB?~0t`??6uENOtC==N~NK5%Ehn*W?9I7Jnk;qj5Pr z9G8dq9?BO^ApY(zJ@6zSnSsneW*{?=8ORL$8wU8>i=(w(wfUME$P8o#W(;tB=;37B zuiMM2)ujU$rttipDZC!IN2;#RdUe~c+smp|C@=~|TS1F@i&0c?JnvB)ZNF|WtG0qm zQNg9CEf@6;rBLg@^;BGne%0n{W*{>#&%j4`v>EKZ2Qt;Y_!PVNxm|eiCnlHOg|8}l zD&I>fqZndwH$ZGSMAF*A+W<>zv~wY2tuoB{C%HLTI8CrpF?>*t5nU6p@NaM zn9Tr_w5aj5=#HW%^+@8}ntk->J&Ma;#f=gP~ zm|6{FtyG%>+)Z#lgeM$f5&Mkr;%6qpcN@`3FBos9r&ZhL?1`Z7^_16;3W`zhw{F+N3nP^PR8_ixma^h(Ey)z_N+VvR7% zrgGqU(->R%)tUSS?zo1Y2MET-B50w+A0%Tv-}@EK89znVt$dSr4LQ?yO8s!q*aa{ho8?N@{`O!W*{?=8ORJ|2L5jhaR0xKoN1zY z&@t|Y@vMcJgzUIXB1GMoNjUs6Y;ivl%NLQ8J6U>2*`x(#nGV&}tee^02uNnCXV7sZ zKgO*xhjaM%6Zo_z$R3@hZP}Hl$m{pv$5Z(NSAKqiC*R=iYj6#D0Ve4+^HOKAb-i;+vP=`}|- zd&+7MM|-5VjGF81Rs@%{%;-4{E$l!}p@s7-Vv(b=_{s3wG4e@EjJ&fHB41<2-N>** zZU;6i^bLoAWPn?>;}dw zYp480DKUn)mNd*49lh_&=)Kc`P4V6Mf|`(WZ>_D!W4vFti(if>@=W%9 zzcj*Dx`oQo0V)DVSCJ0nIiIfOtExfL@4WxVDw~hYKxQB_kQvAf+$ILzt2*;w9qoSe z`~SD8%egO^fy_X_K(Vy4e!lMj{pDw literal 0 HcmV?d00001 diff --git a/generator.go b/generator.go index 9442411..c8ee64d 100644 --- a/generator.go +++ b/generator.go @@ -1,6 +1,7 @@ package pgs import ( + "fmt" "io" "log" "os" @@ -27,6 +28,8 @@ type Generator struct { // Init configures a new Generator. InitOptions may be provided as well to // modify the behavior of the generator. func Init(opts ...InitOption) *Generator { + persister := newPersister() + fmt.Fprintln(os.Stderr, "min edition from generator:", persister.minimumEdition) g := &Generator{ in: os.Stdin, out: os.Stdout, diff --git a/go.mod b/go.mod index 1b3de90..cbdc186 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/spf13/afero v1.3.3 github.com/stretchr/testify v1.6.1 golang.org/x/tools v0.1.12 - google.golang.org/protobuf v1.23.0 + google.golang.org/protobuf v1.34.2 ) require ( diff --git a/go.sum b/go.sum index 644796e..d4f51ab 100644 --- a/go.sum +++ b/go.sum @@ -5,10 +5,13 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= @@ -59,6 +62,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/init_option.go b/init_option.go index 5c92c2f..7ff22a6 100644 --- a/init_option.go +++ b/init_option.go @@ -1,6 +1,7 @@ package pgs import ( + "fmt" "io" "os" @@ -55,3 +56,20 @@ func SupportedFeatures(feat *uint64) InitOption { g.persister.SetSupportedFeatures(feat) } } + +// MinimumEdition allows defining protoc features to enable / disable. +// See: https://protobuf.dev/editions/implementation/ +func MinimumEdition(me *int32) InitOption { + return func(g *Generator) { + g.persister.SetMinimumEdition(me) + } +} + +// MaximumEdition allows defining protoc features to enable / disable. +// See: https://protobuf.dev/editions/implementation/ +func MaximumEdition(me *int32) InitOption { + return func(g *Generator) { + fmt.Fprintln(os.Stderr, "in max edition:", *me) + g.persister.SetMaximumEdition(me) + } +} diff --git a/persister.go b/persister.go index fc47086..29495af 100644 --- a/persister.go +++ b/persister.go @@ -1,6 +1,7 @@ package pgs import ( + "fmt" "os" "path/filepath" "strings" @@ -14,6 +15,8 @@ type persister interface { SetDebugger(d Debugger) SetFS(fs afero.Fs) SetSupportedFeatures(f *uint64) + SetMaximumEdition(me *int32) + SetMinimumEdition(me *int32) AddPostProcessor(proc ...PostProcessor) Persist(a ...Artifact) *plugin_go.CodeGeneratorResponse } @@ -24,6 +27,8 @@ type stdPersister struct { fs afero.Fs procs []PostProcessor supportedFeatures *uint64 + maximumEdition *int32 + minimumEdition *int32 } func newPersister() *stdPersister { return &stdPersister{fs: afero.NewOsFs()} } @@ -31,11 +36,19 @@ func newPersister() *stdPersister { return &stdPersister{fs: afero.NewOsFs()} } func (p *stdPersister) SetDebugger(d Debugger) { p.Debugger = d } func (p *stdPersister) SetFS(fs afero.Fs) { p.fs = fs } func (p *stdPersister) SetSupportedFeatures(f *uint64) { p.supportedFeatures = f } +func (p *stdPersister) SetMaximumEdition(me *int32) { p.maximumEdition = me } +func (p *stdPersister) SetMinimumEdition(me *int32) { p.minimumEdition = me } func (p *stdPersister) AddPostProcessor(proc ...PostProcessor) { p.procs = append(p.procs, proc...) } func (p *stdPersister) Persist(arts ...Artifact) *plugin_go.CodeGeneratorResponse { resp := new(plugin_go.CodeGeneratorResponse) resp.SupportedFeatures = p.supportedFeatures + resp.MaximumEdition = p.maximumEdition + resp.MinimumEdition = p.minimumEdition + + fmt.Fprintln(os.Stderr, "max edition:", *resp.MaximumEdition) + fmt.Fprintln(os.Stderr, "min edition:", *resp.MinimumEdition) + fmt.Fprintln(os.Stderr, "supported features:", *resp.SupportedFeatures) for _, a := range arts { switch a := a.(type) { diff --git a/protoc-gen-debug/main.go b/protoc-gen-debug/main.go index da14fdd..5315b26 100644 --- a/protoc-gen-debug/main.go +++ b/protoc-gen-debug/main.go @@ -5,6 +5,7 @@ package main import ( "bytes" + "fmt" "io" "io/ioutil" "log" @@ -18,6 +19,7 @@ import ( ) func main() { + fmt.Fprintln(os.Stderr, "does this execute? yes") data, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatal("unable to read input: ", err) @@ -44,9 +46,13 @@ func main() { } // protoc-gen-debug supports proto3 field presence for testing purposes - var supportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) + var supportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + var minimumEdition = int32(2023) + var maximumEdition = int32(2023) if data, err = proto.Marshal(&plugin_go.CodeGeneratorResponse{ SupportedFeatures: &supportedFeatures, + MinimumEdition: &minimumEdition, + MaximumEdition: &maximumEdition, }); err != nil { log.Fatal("unable to marshal response payload: ", err) } diff --git a/testdata/protos/kitchen/fridge.proto b/testdata/protos/kitchen/fridge.proto new file mode 100644 index 0000000..5af3ee3 --- /dev/null +++ b/testdata/protos/kitchen/fridge.proto @@ -0,0 +1,44 @@ +edition = "2023"; + +package kitchen; +option go_package = "github.com/lyft/protoc-gen-star/testdata/generated/kitchen"; + +import "google/protobuf/timestamp.proto"; + +message Fridge { + Brand brand = 1; + Material material = 2; + string model = 3; + google.protobuf.Timestamp installed = 4; + + enum Brand { + KRAUS = 0; + SWANSTONE = 1; + HOUZER = 2; + BLANCO = 3; + KOHLER = 4; + } + + message Material { + Type type = 1; + Finish finish = 2; + + enum Type { + STAINLESS_STEEL = 0; + COPPER = 1; + GRANITE = 2; + SOAPSTONE = 3; + CERAMIC = 4; + CAST_IRON = 5; + } + + enum Finish { + NONE = 0; + POLISHED = 1; + MIRROR = 2; + HAMMERED_MIRROR = 3; + BRIGHT_SATIN = 4; + BRUSHED_SATIN = 5; + } + } +} diff --git a/workflow.go b/workflow.go index fb30a50..c21b2cf 100644 --- a/workflow.go +++ b/workflow.go @@ -1,7 +1,9 @@ package pgs import ( + "fmt" "io/ioutil" + "os" "sync" "google.golang.org/protobuf/proto" @@ -65,8 +67,11 @@ func (wf *standardWorkflow) Run(ast AST) (arts []Artifact) { } func (wf *standardWorkflow) Persist(arts []Artifact) { + fmt.Fprintln(os.Stderr, "before persist") resp := wf.persister.Persist(arts...) + fmt.Fprintln(os.Stderr, "resp after persist", resp) + data, err := proto.Marshal(resp) wf.CheckErr(err, "marshaling output proto") @@ -75,6 +80,7 @@ func (wf *standardWorkflow) Persist(arts []Artifact) { wf.Assert(len(data) == n, "failed to write all output") wf.Debug("rendering successful") + fmt.Fprintln(os.Stderr, "rendering done") } // onceWorkflow wraps an existing workflow, executing its methods exactly From 4df86441312942c3f44104df854ff4119f872b47 Mon Sep 17 00:00:00 2001 From: Vaidehi Duraphe Date: Mon, 26 Aug 2024 16:30:52 -0700 Subject: [PATCH 2/5] remove testing logs, test --- ast_test.go | 3 +++ generator.go | 3 --- init_option.go | 2 -- persister.go | 5 ----- protoc-gen-debug/main.go | 2 -- workflow.go | 6 ------ 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/ast_test.go b/ast_test.go index 4defd4a..2ebea5d 100644 --- a/ast_test.go +++ b/ast_test.go @@ -374,10 +374,13 @@ func TestGraph_Bidirectional(t *testing.T) { require.True(t, ok) kitchenProto, ok := ast.Lookup("kitchen/kitchen.proto") require.True(t, ok) + fridgeProto, ok := ast.Lookup("kitchen/fridge.proto") + require.True(t, ok) assert.Len(t, deps, 2) assert.Contains(t, deps, sinkProto) assert.Contains(t, deps, kitchenProto) + assert.Contains(t, deps, fridgeProto) }) } diff --git a/generator.go b/generator.go index c8ee64d..9442411 100644 --- a/generator.go +++ b/generator.go @@ -1,7 +1,6 @@ package pgs import ( - "fmt" "io" "log" "os" @@ -28,8 +27,6 @@ type Generator struct { // Init configures a new Generator. InitOptions may be provided as well to // modify the behavior of the generator. func Init(opts ...InitOption) *Generator { - persister := newPersister() - fmt.Fprintln(os.Stderr, "min edition from generator:", persister.minimumEdition) g := &Generator{ in: os.Stdin, out: os.Stdout, diff --git a/init_option.go b/init_option.go index 7ff22a6..24a0ea5 100644 --- a/init_option.go +++ b/init_option.go @@ -1,7 +1,6 @@ package pgs import ( - "fmt" "io" "os" @@ -69,7 +68,6 @@ func MinimumEdition(me *int32) InitOption { // See: https://protobuf.dev/editions/implementation/ func MaximumEdition(me *int32) InitOption { return func(g *Generator) { - fmt.Fprintln(os.Stderr, "in max edition:", *me) g.persister.SetMaximumEdition(me) } } diff --git a/persister.go b/persister.go index 29495af..84bc699 100644 --- a/persister.go +++ b/persister.go @@ -1,7 +1,6 @@ package pgs import ( - "fmt" "os" "path/filepath" "strings" @@ -46,10 +45,6 @@ func (p *stdPersister) Persist(arts ...Artifact) *plugin_go.CodeGeneratorRespons resp.MaximumEdition = p.maximumEdition resp.MinimumEdition = p.minimumEdition - fmt.Fprintln(os.Stderr, "max edition:", *resp.MaximumEdition) - fmt.Fprintln(os.Stderr, "min edition:", *resp.MinimumEdition) - fmt.Fprintln(os.Stderr, "supported features:", *resp.SupportedFeatures) - for _, a := range arts { switch a := a.(type) { case GeneratorFile: diff --git a/protoc-gen-debug/main.go b/protoc-gen-debug/main.go index 5315b26..a5a73b3 100644 --- a/protoc-gen-debug/main.go +++ b/protoc-gen-debug/main.go @@ -5,7 +5,6 @@ package main import ( "bytes" - "fmt" "io" "io/ioutil" "log" @@ -19,7 +18,6 @@ import ( ) func main() { - fmt.Fprintln(os.Stderr, "does this execute? yes") data, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatal("unable to read input: ", err) diff --git a/workflow.go b/workflow.go index c21b2cf..fb30a50 100644 --- a/workflow.go +++ b/workflow.go @@ -1,9 +1,7 @@ package pgs import ( - "fmt" "io/ioutil" - "os" "sync" "google.golang.org/protobuf/proto" @@ -67,11 +65,8 @@ func (wf *standardWorkflow) Run(ast AST) (arts []Artifact) { } func (wf *standardWorkflow) Persist(arts []Artifact) { - fmt.Fprintln(os.Stderr, "before persist") resp := wf.persister.Persist(arts...) - fmt.Fprintln(os.Stderr, "resp after persist", resp) - data, err := proto.Marshal(resp) wf.CheckErr(err, "marshaling output proto") @@ -80,7 +75,6 @@ func (wf *standardWorkflow) Persist(arts []Artifact) { wf.Assert(len(data) == n, "failed to write all output") wf.Debug("rendering successful") - fmt.Fprintln(os.Stderr, "rendering done") } // onceWorkflow wraps an existing workflow, executing its methods exactly From 030c8cce3f37287c2e731ccd20b5fb5d0ab70202 Mon Sep 17 00:00:00 2001 From: Vaidehi Duraphe Date: Mon, 26 Aug 2024 17:17:47 -0700 Subject: [PATCH 3/5] update comments, remove fridge --- ast_test.go | 3 -- init_option.go | 4 +-- testdata/protos/kitchen/fridge.proto | 44 ---------------------------- 3 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 testdata/protos/kitchen/fridge.proto diff --git a/ast_test.go b/ast_test.go index 2ebea5d..4defd4a 100644 --- a/ast_test.go +++ b/ast_test.go @@ -374,13 +374,10 @@ func TestGraph_Bidirectional(t *testing.T) { require.True(t, ok) kitchenProto, ok := ast.Lookup("kitchen/kitchen.proto") require.True(t, ok) - fridgeProto, ok := ast.Lookup("kitchen/fridge.proto") - require.True(t, ok) assert.Len(t, deps, 2) assert.Contains(t, deps, sinkProto) assert.Contains(t, deps, kitchenProto) - assert.Contains(t, deps, fridgeProto) }) } diff --git a/init_option.go b/init_option.go index 24a0ea5..d338485 100644 --- a/init_option.go +++ b/init_option.go @@ -56,7 +56,7 @@ func SupportedFeatures(feat *uint64) InitOption { } } -// MinimumEdition allows defining protoc features to enable / disable. +// Generators must specify exactly which editions they support. MinimumEdition and MaximumEdition fields for specify the precise support window. // See: https://protobuf.dev/editions/implementation/ func MinimumEdition(me *int32) InitOption { return func(g *Generator) { @@ -64,7 +64,7 @@ func MinimumEdition(me *int32) InitOption { } } -// MaximumEdition allows defining protoc features to enable / disable. +// Generators must specify exactly which editions they support. MinimumEdition and MaximumEdition fields for specify the precise support window. // See: https://protobuf.dev/editions/implementation/ func MaximumEdition(me *int32) InitOption { return func(g *Generator) { diff --git a/testdata/protos/kitchen/fridge.proto b/testdata/protos/kitchen/fridge.proto deleted file mode 100644 index 5af3ee3..0000000 --- a/testdata/protos/kitchen/fridge.proto +++ /dev/null @@ -1,44 +0,0 @@ -edition = "2023"; - -package kitchen; -option go_package = "github.com/lyft/protoc-gen-star/testdata/generated/kitchen"; - -import "google/protobuf/timestamp.proto"; - -message Fridge { - Brand brand = 1; - Material material = 2; - string model = 3; - google.protobuf.Timestamp installed = 4; - - enum Brand { - KRAUS = 0; - SWANSTONE = 1; - HOUZER = 2; - BLANCO = 3; - KOHLER = 4; - } - - message Material { - Type type = 1; - Finish finish = 2; - - enum Type { - STAINLESS_STEEL = 0; - COPPER = 1; - GRANITE = 2; - SOAPSTONE = 3; - CERAMIC = 4; - CAST_IRON = 5; - } - - enum Finish { - NONE = 0; - POLISHED = 1; - MIRROR = 2; - HAMMERED_MIRROR = 3; - BRIGHT_SATIN = 4; - BRUSHED_SATIN = 5; - } - } -} From b81dcbe42082a2dfc8ae8802387855a20edacccb Mon Sep 17 00:00:00 2001 From: Vaidehi Duraphe Date: Tue, 27 Aug 2024 09:59:45 -0700 Subject: [PATCH 4/5] update go mod --- go.mod | 3 ++- go.sum | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cbdc186..387c6fc 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,9 @@ -module github.com/lyft/protoc-gen-star/v2 +module github.com/vaidehi-figma/protoc-gen-star go 1.17 require ( + github.com/lyft/protoc-gen-star/v2 v2.0.3 github.com/spf13/afero v1.3.3 github.com/stretchr/testify v1.6.1 golang.org/x/tools v0.1.12 diff --git a/go.sum b/go.sum index d4f51ab..8f568b6 100644 --- a/go.sum +++ b/go.sum @@ -8,11 +8,12 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/lyft/protoc-gen-star/v2 v2.0.3 h1:/3+/2sWyXeMLzKd1bX+ixWKgEMsULrIivpDsuaF441o= +github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -60,8 +61,8 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= From 84f66dcdf8b83b5b1cb2435d4cba27e87f370562 Mon Sep 17 00:00:00 2001 From: Vaidehi Duraphe Date: Tue, 27 Aug 2024 10:03:42 -0700 Subject: [PATCH 5/5] remove references to the original protoc-gen-star --- go.mod | 1 - go.sum | 16 ---------------- lang/go/camel.go | 2 +- lang/go/context.go | 2 +- lang/go/context_test.go | 2 +- lang/go/gofmt.go | 2 +- lang/go/gofmt_test.go | 2 +- lang/go/goimports.go | 2 +- lang/go/goimports_test.go | 2 +- lang/go/helpers_test.go | 2 +- lang/go/name.go | 2 +- lang/go/name_test.go | 2 +- lang/go/package.go | 2 +- lang/go/package_test.go | 2 +- lang/go/parameters.go | 2 +- lang/go/parameters_test.go | 2 +- lang/go/type_name.go | 2 +- lang/go/type_name_p2_presence_test.go | 2 +- lang/go/type_name_p3_presence_test.go | 3 ++- lang/go/type_name_test.go | 2 +- testdata/protoc-gen-example/jsonify.go | 16 ++++++++-------- testdata/protoc-gen-example/main.go | 4 ++-- testdata/protoc-gen-example/printer.go | 2 +- testutils/loader.go | 2 +- 24 files changed, 31 insertions(+), 47 deletions(-) diff --git a/go.mod b/go.mod index 387c6fc..b891d2c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/vaidehi-figma/protoc-gen-star go 1.17 require ( - github.com/lyft/protoc-gen-star/v2 v2.0.3 github.com/spf13/afero v1.3.3 github.com/stretchr/testify v1.6.1 golang.org/x/tools v0.1.12 diff --git a/go.sum b/go.sum index 8f568b6..fe2a29b 100644 --- a/go.sum +++ b/go.sum @@ -1,19 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/lyft/protoc-gen-star/v2 v2.0.3 h1:/3+/2sWyXeMLzKd1bX+ixWKgEMsULrIivpDsuaF441o= -github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -56,12 +46,6 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/lang/go/camel.go b/lang/go/camel.go index d09b81b..e59df2d 100644 --- a/lang/go/camel.go +++ b/lang/go/camel.go @@ -1,7 +1,7 @@ package pgsgo import ( - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) // PGGUpperCamelCase converts Name n to the protoc-gen-go defined upper diff --git a/lang/go/context.go b/lang/go/context.go index ac5ac43..d94fc86 100644 --- a/lang/go/context.go +++ b/lang/go/context.go @@ -1,6 +1,6 @@ package pgsgo -import pgs "github.com/lyft/protoc-gen-star/v2" +import pgs "github.com/vaidehi-figma/protoc-gen-star" // Context resolves Go-specific language for Packages & Entities generated by // protoc-gen-go. The rules that drive the naming behavior are complicated, and diff --git a/lang/go/context_test.go b/lang/go/context_test.go index 7b6df09..5417c57 100644 --- a/lang/go/context_test.go +++ b/lang/go/context_test.go @@ -3,8 +3,8 @@ package pgsgo import ( "testing" - pgs "github.com/lyft/protoc-gen-star/v2" "github.com/stretchr/testify/assert" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestContext_Params(t *testing.T) { diff --git a/lang/go/gofmt.go b/lang/go/gofmt.go index 34bee58..1738eb2 100644 --- a/lang/go/gofmt.go +++ b/lang/go/gofmt.go @@ -4,7 +4,7 @@ import ( "go/format" "strings" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) type goFmt struct{} diff --git a/lang/go/gofmt_test.go b/lang/go/gofmt_test.go index fc814cc..03eb09a 100644 --- a/lang/go/gofmt_test.go +++ b/lang/go/gofmt_test.go @@ -3,7 +3,7 @@ package pgsgo import ( "testing" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" "github.com/stretchr/testify/assert" ) diff --git a/lang/go/goimports.go b/lang/go/goimports.go index 2d05ca1..0b15d6b 100644 --- a/lang/go/goimports.go +++ b/lang/go/goimports.go @@ -5,7 +5,7 @@ import ( "golang.org/x/tools/imports" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) type goImports struct{} diff --git a/lang/go/goimports_test.go b/lang/go/goimports_test.go index 36cc68b..0cb1ab1 100644 --- a/lang/go/goimports_test.go +++ b/lang/go/goimports_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestGoImports_Match(t *testing.T) { diff --git a/lang/go/helpers_test.go b/lang/go/helpers_test.go index 30ac496..629ce81 100644 --- a/lang/go/helpers_test.go +++ b/lang/go/helpers_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - pgs "github.com/lyft/protoc-gen-star/v2" "github.com/stretchr/testify/require" + pgs "github.com/vaidehi-figma/protoc-gen-star" "google.golang.org/protobuf/proto" plugin_go "google.golang.org/protobuf/types/pluginpb" ) diff --git a/lang/go/name.go b/lang/go/name.go index 43fdfcd..75a0ab4 100644 --- a/lang/go/name.go +++ b/lang/go/name.go @@ -5,7 +5,7 @@ import ( "unicode" "unicode/utf8" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func (c context) Name(node pgs.Node) pgs.Name { diff --git a/lang/go/name_test.go b/lang/go/name_test.go index c7ad547..db8d132 100644 --- a/lang/go/name_test.go +++ b/lang/go/name_test.go @@ -3,9 +3,9 @@ package pgsgo import ( "testing" - pgs "github.com/lyft/protoc-gen-star/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestPGGUpperCamelCase(t *testing.T) { diff --git a/lang/go/package.go b/lang/go/package.go index 6100271..0834ca7 100644 --- a/lang/go/package.go +++ b/lang/go/package.go @@ -7,7 +7,7 @@ import ( "unicode" "unicode/utf8" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) var nonAlphaNumPattern = regexp.MustCompile("[^a-zA-Z0-9]") diff --git a/lang/go/package_test.go b/lang/go/package_test.go index 16ed59b..4999601 100644 --- a/lang/go/package_test.go +++ b/lang/go/package_test.go @@ -3,9 +3,9 @@ package pgsgo import ( "testing" - pgs "github.com/lyft/protoc-gen-star/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestPackageName(t *testing.T) { diff --git a/lang/go/parameters.go b/lang/go/parameters.go index adcdc0c..492e493 100644 --- a/lang/go/parameters.go +++ b/lang/go/parameters.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) const ( diff --git a/lang/go/parameters_test.go b/lang/go/parameters_test.go index 2682a6b..02d74ec 100644 --- a/lang/go/parameters_test.go +++ b/lang/go/parameters_test.go @@ -3,8 +3,8 @@ package pgsgo import ( "testing" - pgs "github.com/lyft/protoc-gen-star/v2" "github.com/stretchr/testify/assert" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestParameters_Plugins(t *testing.T) { diff --git a/lang/go/type_name.go b/lang/go/type_name.go index 2e650f9..7110130 100644 --- a/lang/go/type_name.go +++ b/lang/go/type_name.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func (c context) Type(f pgs.Field) TypeName { diff --git a/lang/go/type_name_p2_presence_test.go b/lang/go/type_name_p2_presence_test.go index ebe590b..63d21e3 100644 --- a/lang/go/type_name_p2_presence_test.go +++ b/lang/go/type_name_p2_presence_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestType(t *testing.T) { diff --git a/lang/go/type_name_p3_presence_test.go b/lang/go/type_name_p3_presence_test.go index cb0a2bc..11e9fc7 100644 --- a/lang/go/type_name_p3_presence_test.go +++ b/lang/go/type_name_p3_presence_test.go @@ -1,3 +1,4 @@ +//go:build proto3_presence // +build proto3_presence package pgsgo @@ -8,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestType(t *testing.T) { diff --git a/lang/go/type_name_test.go b/lang/go/type_name_test.go index 9215d6b..6ccb214 100644 --- a/lang/go/type_name_test.go +++ b/lang/go/type_name_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) func TestTypeName(t *testing.T) { diff --git a/testdata/protoc-gen-example/jsonify.go b/testdata/protoc-gen-example/jsonify.go index 63df888..411a82e 100644 --- a/testdata/protoc-gen-example/jsonify.go +++ b/testdata/protoc-gen-example/jsonify.go @@ -3,9 +3,9 @@ package main import ( "text/template" - pgsgo "github.com/lyft/protoc-gen-star/v2/lang/go" + pgsgo "github.com/vaidehi-figma/protoc-gen-star/lang/go" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) // JSONifyPlugin adds encoding/json Marshaler and Unmarshaler methods on PB @@ -74,12 +74,12 @@ import ( {{ range .AllMessages }} -// {{ marshaler . }} describes the default jsonpb.Marshaler used by all -// instances of {{ name . }}. This struct is safe to replace or modify but +// {{ marshaler . }} describes the default jsonpb.Marshaler used by all +// instances of {{ name . }}. This struct is safe to replace or modify but // should not be done so concurrently. var {{ marshaler . }} = new(jsonpb.Marshaler) -// MarshalJSON satisfies the encoding/json Marshaler interface. This method +// MarshalJSON satisfies the encoding/json Marshaler interface. This method // uses the more correct jsonpb package to correctly marshal the message. func (m *{{ name . }}) MarshalJSON() ([]byte, error) { if m == nil { @@ -97,12 +97,12 @@ func (m *{{ name . }}) MarshalJSON() ([]byte, error) { var _ json.Marshaler = (*{{ name . }})(nil) -// {{ unmarshaler . }} describes the default jsonpb.Unmarshaler used by all -// instances of {{ name . }}. This struct is safe to replace or modify but +// {{ unmarshaler . }} describes the default jsonpb.Unmarshaler used by all +// instances of {{ name . }}. This struct is safe to replace or modify but // should not be done so concurrently. var {{ unmarshaler . }} = new(jsonpb.Unmarshaler) -// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method +// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method // uses the more correct jsonpb package to correctly unmarshal the message. func (m *{{ name . }}) UnmarshalJSON(b []byte) error { return {{ unmarshaler . }}.Unmarshal(bytes.NewReader(b), m) diff --git a/testdata/protoc-gen-example/main.go b/testdata/protoc-gen-example/main.go index 4ef5d32..f22c157 100644 --- a/testdata/protoc-gen-example/main.go +++ b/testdata/protoc-gen-example/main.go @@ -1,8 +1,8 @@ package main import ( - pgs "github.com/lyft/protoc-gen-star/v2" - pgsgo "github.com/lyft/protoc-gen-star/v2/lang/go" + pgs "github.com/vaidehi-figma/protoc-gen-star" + pgsgo "github.com/vaidehi-figma/protoc-gen-star/lang/go" ) func main() { diff --git a/testdata/protoc-gen-example/printer.go b/testdata/protoc-gen-example/printer.go index 1517947..c639c46 100644 --- a/testdata/protoc-gen-example/printer.go +++ b/testdata/protoc-gen-example/printer.go @@ -7,7 +7,7 @@ import ( "bytes" - pgs "github.com/lyft/protoc-gen-star/v2" + pgs "github.com/vaidehi-figma/protoc-gen-star" ) type PrinterModule struct { diff --git a/testutils/loader.go b/testutils/loader.go index f349e19..38d0a6e 100644 --- a/testutils/loader.go +++ b/testutils/loader.go @@ -6,8 +6,8 @@ import ( "os/exec" "path/filepath" - pgs "github.com/lyft/protoc-gen-star/v2" "github.com/spf13/afero" + pgs "github.com/vaidehi-figma/protoc-gen-star" "google.golang.org/protobuf/proto" descriptor "google.golang.org/protobuf/types/descriptorpb" )