Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block with indent indicator is not parsed correctly #399

Closed
martin-sucha opened this issue Oct 4, 2023 · 0 comments · Fixed by #506
Closed

Block with indent indicator is not parsed correctly #399

martin-sucha opened this issue Oct 4, 2023 · 0 comments · Fixed by #506
Labels
bug Something isn't working

Comments

@martin-sucha
Copy link
Contributor

Describe the bug
Yaml with block indent indicator is not parsed corrrectly, the spaces at the beginning are trimmed.

To Reproduce

package main

import (
	"os"

	"github.com/goccy/go-yaml/parser"
)

func main() {
	input, err := os.ReadFile("input6.yaml")
	if err != nil {
		panic(err)
	}
	f, err := parser.ParseBytes(input, 0)
	if err != nil {
		panic(err)
	}
	_, err = os.Stdout.Write([]byte(f.String()))
	if err != nil {
		panic(err)
	}
}
|2-

                  text

Expected behavior

Expected to get the same output as input, but got:

2-
text

The yaml should be equivalent to

"\n                text"

Version Variables

  • Go version: go1.21.1
  • go-yaml's Version: v1.11.2

Additional context
Add any other context about the problem here.

@martin-sucha martin-sucha added the bug Something isn't working label Oct 4, 2023
martin-sucha added a commit to kiwicom/go-yaml that referenced this issue Oct 6, 2023
The lexer did not recognize block scalar header with both
indentation indicator and chomping indicator.

Closes goccy#399
martin-sucha added a commit to kiwicom/go-yaml that referenced this issue Oct 6, 2023
The lexer did not recognize block scalar header with both
indentation indicator and chomping indicator.

Closes goccy#399
@goccy goccy closed this as completed in #506 Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant