Skip to content

Commit

Permalink
Fix "error error" type shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
lesiw committed Aug 2, 2024
1 parent c839782 commit 2c5995f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ func resultparams(tup *types.Tuple) string {
}
if v.Name() == "" {
b.WriteString(fmt.Sprintf("r%d", i))
} else if v.Name() == "error" {
// Fix a common type shadowing error.
b.WriteString("err")
} else {
b.WriteString(v.Name())
}
Expand Down Expand Up @@ -260,6 +263,9 @@ func resultargs(tup *types.Tuple) string {
}
if v.Name() == "" {
b.WriteString(fmt.Sprintf("r%d", i))
} else if v.Name() == "error" {
// Fix a common type shadowing error.
b.WriteString("err")
} else {
b.WriteString(v.Name())
}
Expand Down

0 comments on commit 2c5995f

Please sign in to comment.