Skip to content

Commit

Permalink
fix: fix code to follow the change of goccy/go-yaml (#1098)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke authored Feb 13, 2025
1 parent f88fb8d commit 19969e7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/mv/registry_ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,15 @@ func insertAliases(value ast.Node, idx int, oldPackageName string) error {
if err != nil {
return fmt.Errorf("parse text as YAML: %w", err)
}
mn, ok := f.Docs[0].Body.(*ast.MappingValueNode)
mn, ok := f.Docs[0].Body.(*ast.MappingNode)
if !ok {
return errors.New("body must be a mapping node")
}

latterValues := make([]*ast.MappingValueNode, len(mv.Values[idx:]))
copy(latterValues, mv.Values[idx:])
mv.Values = mv.Values[:idx]
mv.Merge(&ast.MappingNode{
Values: []*ast.MappingValueNode{
mn,
},
})
mv.Merge(mn)
mv.Merge(&ast.MappingNode{
Values: latterValues,
})
Expand Down

0 comments on commit 19969e7

Please sign in to comment.