initial work on samplegen#3
Conversation
vchudnov-g
left a comment
There was a problem hiding this comment.
Looks good as scaffolding, but there are some changes I'd make before committing (imports in the generated sample, etc) so that the generated code runs, and I'd add some strategic TODOs throughout.
Aside from that, minor comments about initialisms and descriptive names.
| } | ||
| } | ||
|
|
||
| type GapicValueSet struct { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| Methods []GapicMethod | ||
| } | ||
|
|
||
| type GapicMethod struct { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| type GapicValueSet struct { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| type generator struct { | ||
| desc descriptor.FileDescriptorSet | ||
| dinfo pbinfo.Info |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| gapic GapicConfig | ||
|
|
||
| pt printer.P | ||
| imps map[pbinfo.ImportSpec]bool |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| p := g.pt.Printf | ||
|
|
||
| p("// [START %s]", valSet.ID) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| var file bytes.Buffer | ||
| file.WriteString("package main\n") | ||
| file.WriteString("import(\n") | ||
| for _, imp := range imps { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,22 @@ | |||
| // [START my_value_set] | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| // [START my_value_set] | ||
|
|
||
| func sampleMyMethod() { | ||
| ctx := context.Background() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
yihanzhen
left a comment
There was a problem hiding this comment.
This is much easier to understand than what I expected... One question though. Other than that LGTM
| fi | ||
|
|
||
| ./gen-go-sample \ | ||
| -gapic "$GOOGLEAPIS/google/cloud/language/v1/language_gapic.yaml" \ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@hzyi-google I'm glad to hear! :P |
Vulnerability #1: GO-2023-1571 Denial of service via crafted HTTP/2 stream in net/http and golang.org/x/net More info: https://pkg.go.dev/vuln/GO-2023-1571 Module: golang.org/x/net Found in: golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4 Fixed in: golang.org/x/net@v0.7.0 Example traces found: #1: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.ErrCode.String #2: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.FrameType.String #3: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.Setting.String #4: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.SettingID.String googleapis#5: internal/printer/printer.go:62:13: printer.P.Printf calls fmt.Fprintf, which eventually calls http2.chunkWriter.Write googleapis#6: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.duplicatePseudoHeaderError.Error googleapis#7: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.headerFieldNameError.Error googleapis#8: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.headerFieldValueError.Error googleapis#9: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.pseudoHeaderError.Error googleapis#10: internal/gengapic/options.go:172:21: gengapic.transport.String calls fmt.Sprintf, which eventually calls http2.writeData.String
No description provided.