Comments (5)
Thank you for reporting!
This code is a bug, so I'll fix it.
from go-yaml.
Perhaps I could fix this issue with the above PR. Could you check it ?
from go-yaml.
Sorry it has taken me so long, I've been on holiday. I am going to work on validating this today.
You should know that I'm using https://github.com/yaml/yaml-test-suite to validate the changes. I can submit more issues based on what I find, if you'd like them. I know that the yaml-test-suite
checks many corner cases which may not apply to general use cases.
from go-yaml.
Hi @goccy!
Thanks for your attention to this. I tried this branch with the YAML 1.1 example:
package main
import (
"fmt"
"github.com/goccy/go-yaml"
)
type Result struct {
Sequence []string `yaml:"sequence"`
Mapping map[string]string `yaml:"mapping"`
}
func main() {
var result Result
if err := yaml.Unmarshal([]byte(`
sequence:
- one
- two
mapping:
? sky
: blue
? sea : green`), &result); err != nil {
panic(err)
}
fmt.Println("good!")
fmt.Println(result)
}
This panics:
panic: [6:5] unexpected key name
3 | - one
4 | - two
5 | mapping:? sky
^
7 | : blue
8 | ? sea : green
This is the kind of case I would expect to be fixed in this issue. It doesn't look like #151 resolves this problem.
Note that #151 is a tiny improvement, though. v1.7.17 incorrectly renders %
where #151 renders ?
.
panic: [6:5] unexpected key name
3 | - one
4 | - two
5 | mapping:% sky
^
7 | : blue
8 | % sea : green
from go-yaml.
You should know that go-yaml has some issues with this syntax as well, they're just different. go-yaml/yaml#611
from go-yaml.
Related Issues (20)
- Please verify 0b*** binary content and fallback to string
- Compile error HOT 1
- Multi-line strings don't work when there are curly braces
- comment after `-` causes subsequent queries to fail HOT 3
- 1.11.2 is mis-tagged HOT 1
- Get positional (Line / Column) information on a node HOT 6
- Add option to support mandatory field when decode
- Block with indent indicator is not parsed correctly
- Possibility of encoding tags
- Empty null value gets converted to "null" in token
- Empty null value with line comment causes seg fault
- Trailing new lines are added to literal strings
- Invalid YAML parses successfully: indentation changed after scalar value HOT 2
- Cannot unmarshall structs with slices correctly HOT 2
- Get the values of a mapping node
- Need Help with CustomMarshaler HOT 1
- CommentGroupNode Type() returns CommentType
- Null string gets encoded to null literal
- Empty items in block sequence incorrectly reported as error
- Question: Polymorphism HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-yaml.