Skip to content

Commit

Permalink
Rename default_ parameter to none.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Jul 15, 2024
1 parent e78e786 commit 084364f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions internal/generator/exhaustiveswitch/oneof.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func generateOneOfSwitch(code *jen.File, g *scope.OneOfGroup) {
)
code.Comment("")
code.Commentf(
"It calls the function associated with the default case if x.%s is nil.",
"It calls none() if x.%s is nil.",
g.GoFieldName,
)

Expand All @@ -56,7 +56,7 @@ func generateOneOfSwitch(code *jen.File, g *scope.OneOfGroup) {

code.
Line().
Id("default_").
Id("none").
Func().
Params()

Expand Down Expand Up @@ -94,7 +94,7 @@ func generateOneOfSwitch(code *jen.File, g *scope.OneOfGroup) {

code.
Default().
Id("default_").
Id("none").
Call()
},
),
Expand All @@ -116,11 +116,8 @@ func generateOneOfMap(code *jen.File, g *scope.OneOfGroup) {
"It invokes the function that corresponds to the value of x.%s,",
g.GoFieldName,
)
code.Comment(
"and returns that function's result. It calls the function associated with",
)
code.Commentf(
"the default case if x.%s is nil.",
"and returns that function's result. It calls none() if x.%s is nil.",
g.GoFieldName,
)

Expand Down Expand Up @@ -153,7 +150,7 @@ func generateOneOfMap(code *jen.File, g *scope.OneOfGroup) {

code.
Line().
Id("default_").
Id("none").
Func().
Params().
Params(
Expand Down Expand Up @@ -199,7 +196,7 @@ func generateOneOfMap(code *jen.File, g *scope.OneOfGroup) {
code.
Default().
Return().
Id("default_").
Id("none").
Call()
},
),
Expand Down

0 comments on commit 084364f

Please sign in to comment.