lint: make walkKeys switch exhaustive

The yaml.Kind switch in walkKeys handled only Mapping and Sequence nodes; the exhaustive linter flags the missing Document/Scalar/Alias cases. Add a default branch (those nodes carry no mapping keys to check).

Signed-off-by: Sergey Sannikov <sergey@sannikov.dev>
pull/32505/head
Sergey Sannikov 1 month ago
parent e9bdec1cc4
commit 3f45ceed40

@ -83,6 +83,8 @@ func walkKeys(n *yaml.Node, path string, found *[]booleanLikeKey) {
for i, c := range n.Content { for i, c := range n.Content {
walkKeys(c, fmt.Sprintf("%s[%d]", path, i), found) walkKeys(c, fmt.Sprintf("%s[%d]", path, i), found)
} }
default:
// Scalar, alias and document nodes carry no mapping keys to check.
} }
} }

@ -83,6 +83,8 @@ func walkKeys(n *yaml.Node, path string, found *[]booleanLikeKey) {
for i, c := range n.Content { for i, c := range n.Content {
walkKeys(c, fmt.Sprintf("%s[%d]", path, i), found) walkKeys(c, fmt.Sprintf("%s[%d]", path, i), found)
} }
default:
// Scalar, alias and document nodes carry no mapping keys to check.
} }
} }

Loading…
Cancel
Save