You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the YAML 1.2.2 specification, "@" is a reserved character, but when using goccy/go-yaml, it seemed to be treated as a non-reserved character.
The following is the result of the verification.
Behavior
I have checked the behavior of both with the following code.
package main
import"github.com/goccy/go-yaml"// or "gopkg.in/yaml.v3"typesstruct {
Ss []string
}
varb= []byte(`ss: [@foo, @bar]`)
funcmain() {
varssiferr:=yaml.Unmarshal(b, &s); err!=nil {
panic(err)
}
for_, o:=ranges.Ss {
println(o)
}
}
goccy/go-yaml v1.9.2
$ go run main.go@foo@bar
gopkg.in/yaml.v3 v3.0.1
$ go run main.go
panic: yaml: found character that cannot start any token
...
The text was updated successfully, but these errors were encountered:
I confirmed both go-yaml/yaml and Online YAML Parser failed parsing the characters "@" and "`" while the latest goccy/go-yaml successfully parsing the characters.
=== RUN Test
=== RUN Test/@
test_test.go:29: yaml: found character that cannot start any token
--- FAIL: Test/@ (0.00s)
=== RUN Test/`
test_test.go:29: yaml: found character that cannot start any token
--- FAIL: Test/` (0.00s)
--- FAIL: Test (0.00s)
Description
I found a behavior that I am curious about. Please let me confirm if this is the intended behavior.
According to the YAML 1.2.2 specification, "@" is a reserved character, but when using goccy/go-yaml, it seemed to be treated as a non-reserved character.
The following is the result of the verification.
Behavior
I have checked the behavior of both with the following code.
goccy/go-yaml v1.9.2
gopkg.in/yaml.v3 v3.0.1
The text was updated successfully, but these errors were encountered: