Skip to content

Commit

Permalink
Merge pull request #890 from google/gosec-is-dumb
Browse files Browse the repository at this point in the history
chore: reformat ast mergepositionlist because gosec is buggy
  • Loading branch information
jaqx0r authored Jun 24, 2024
2 parents 8d2101c + 85de4e1 commit a6387e0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions internal/runtime/compiler/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,15 @@ func (n *StopStmt) Type() types.Type {

// mergepositionlist is a helper that merges the positions of all the nodes in a list.
func mergepositionlist(l []Node) *position.Position {
if len(l) == 0 {
switch len(l) {
case 0:
return nil
}
if len(l) == 1 {
if l[0] != nil {
return l[0].Pos()
case 1:
if l[0] == nil {
return nil
}
return nil
return l[0].Pos()
default:
return position.Merge(l[0].Pos(), mergepositionlist(l[1:]))
}
return position.Merge(l[0].Pos(), mergepositionlist(l[1:]))
}

0 comments on commit a6387e0

Please sign in to comment.