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

Allow -0 as an octet integer value #196

Merged
merged 1 commit into from
Feb 2, 2021
Merged

Allow -0 as an octet integer value #196

merged 1 commit into from
Feb 2, 2021

Conversation

nakabonne
Copy link
Contributor

Currently, giving -0 causes panic. This PR is a tiny fix for that.

package main

import (
	"bytes"
	"fmt"
	"log"

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

func main() {
	yml := []byte(`foo: -0`)
	path := "$.foo"
	p, err := goyaml.PathString(path)
	if err != nil {
		log.Fatal(err)
	}

	var value interface{}
	if err := p.Read(bytes.NewReader(yml), &value); err != nil {
		log.Fatal(err)
	}
}

@goccy
Copy link
Owner

goccy commented Feb 2, 2021

Thank you !!!

@goccy goccy merged commit 868d322 into goccy:master Feb 2, 2021
@nakabonne nakabonne deleted the avoid-panic branch February 2, 2021 07:22
pipecd-bot pushed a commit to pipe-cd/pipecd that referenced this pull request Feb 2, 2021
**What this PR does / why we need it**:
Since goccy/go-yaml#194 has been merged and released, we can close #1531.

Besides, goccy/go-yaml#196 is soon-to-be-released, hence we can also close #1530.

**Which issue(s) this PR fixes**:

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
-->
```release-note
NONE
```

This PR was merged by Kapetanios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants