Skip to content

Commit

Permalink
kmsg: change (Request|Response)ForKey to use proper NewPtr functions
Browse files Browse the repository at this point in the history
Now, the stuff will be initialized properly.
  • Loading branch information
twmb committed Jan 29, 2021
1 parent 360a4dc commit c05572d
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 124 deletions.
4 changes: 2 additions & 2 deletions generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func main() {
l.Write("switch key {")
l.Write("default: return nil")
for _, key2struct := range name2structs {
l.Write("case %d: return new(%s)", key2struct.Key, key2struct.Name)
l.Write("case %d: return NewPtr%s()", key2struct.Key, key2struct.Name)
}
l.Write("}")
l.Write("}")
Expand All @@ -453,7 +453,7 @@ func main() {
l.Write("switch key {")
l.Write("default: return nil")
for _, key2struct := range name2structs {
l.Write("case %d: return new(%s)", key2struct.Key, strings.TrimSuffix(key2struct.Name, "Request")+"Response")
l.Write("case %d: return NewPtr%s()", key2struct.Key, strings.TrimSuffix(key2struct.Name, "Request")+"Response")
}
l.Write("}")
l.Write("}")
Expand Down
244 changes: 122 additions & 122 deletions pkg/kmsg/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c05572d

Please sign in to comment.