Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/schema/comments/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (e *CommentError) Render() string {
}

// update yaml error with adjusted line number
if yamlErr, ok := e.Err.(*yaml.TypeError); ok {
if yamlErr, ok := e.Err.(*yaml.LoadErrors); ok {
for _, unmarshalErr := range yamlErr.Errors {
// UnmarshalErrors report line number as 1-indexed
unmarshalErr.Line = displayFile.Lines()[unmarshalErr.Line-1].LineNum
Expand Down
6 changes: 3 additions & 3 deletions pkg/schema/comments/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func TestCommentError_Render_WithYamlTypeError(t *testing.T) {
HeadComment: "# comment line 1\n# comment line 2",
}

// Create a yaml.TypeError
yamlErr := &yaml.TypeError{
Errors: []*yaml.UnmarshalError{
// Create a yaml.LoadError
yamlErr := &yaml.LoadErrors{
Errors: []*yaml.LoadError{
{
Line: 1, // This is relative to the comment block
Err: errors.New("cannot unmarshal string into int"),
Expand Down