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

Open
martin-sucha opened this issue Oct 4, 2023 · 0 comments · May be fixed by #402
Open

Block with indent indicator is not parsed correctly #399

martin-sucha opened this issue Oct 4, 2023 · 0 comments · May be fixed by #402
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 martin-sucha linked a pull request Oct 6, 2023 that will close this issue
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
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
Development

Successfully merging a pull request may close this issue.

1 participant