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

yaml.Marshal panics when serialising [10]bool #144

Closed
davecheney opened this issue Nov 9, 2015 · 3 comments
Closed

yaml.Marshal panics when serialising [10]bool #144

davecheney opened this issue Nov 9, 2015 · 3 comments

Comments

@davecheney
Copy link

yaml.Marshal will panic when fed this value

v := struct{ A, B [10]bool } { } 
PANIC: yaml_test.go:74: yamlSuite.TestWriteYamlWriteGarbage

... Panic: Can't marshal type: [10]bool (PC=0x45B90E)

/home/dfc/go/src/runtime/asm_amd64.s:471
  in call32
/home/dfc/go/src/runtime/panic.go:423
  in gopanic
/home/dfc/src/gopkg.in/yaml.v1/yaml.go:28
  in handleErr
/home/dfc/go/src/runtime/asm_amd64.s:471
  in call32
/home/dfc/go/src/runtime/panic.go:423
  in gopanic
/home/dfc/src/gopkg.in/yaml.v1/encode.go:108
  in encoder.marshal
/home/dfc/src/gopkg.in/yaml.v1/encode.go:141
  in encoder.structv.func1
/home/dfc/src/gopkg.in/yaml.v1/encode.go:155
  in encoder.mappingv
/home/dfc/src/gopkg.in/yaml.v1/encode.go:143
  in encoder.structv
/home/dfc/src/gopkg.in/yaml.v1/encode.go:90
  in encoder.marshal
/home/dfc/src/gopkg.in/yaml.v1/yaml.go:143
  in Marshal

Why doesn't yaml.Marshal return this as an error ?

@aanm
Copy link

aanm commented Jan 9, 2016

Same with [2]int

panic: cannot marshal type: [2]int [recovered]
        panic: cannot marshal type: [2]int [recovered]
        panic: cannot marshal type: [2]int

vinzenz pushed a commit to vinzenz/yaml that referenced this issue Nov 2, 2016
Signed-off-by: Vinzenz Feenstra <evilissmo@redhat.com>
@vinzenz
Copy link

vinzenz commented Nov 2, 2016

This is a duplicate of #130 I can see now

vinzenz pushed a commit to vinzenz/yaml that referenced this issue Nov 3, 2016
Signed-off-by: Vinzenz Feenstra <evilissmo@redhat.com>
vinzenz pushed a commit to vinzenz/yaml that referenced this issue Mar 27, 2017
Signed-off-by: Vinzenz Feenstra <evilissmo@redhat.com>
vinzenz pushed a commit to vinzenz/yaml that referenced this issue Sep 20, 2017
Signed-off-by: Vinzenz Feenstra <evilissmo@redhat.com>
@niemeyer
Copy link
Contributor

That's been fixed by 2aba0a4.

laszlocph added a commit to laszlocph/yaml that referenced this issue Nov 14, 2019
* v/fix-for-issue-91: (40 commits)
  Add test cases from go-yaml#184
  Fix for issue go-yaml#91
  Fixes go-yaml#214 - New option to allow setting strict boolean mode
  Fix for issue go-yaml#144
  Always use the pointer mechanism, but only allow recursion per option
  Applied API changes as suggested in another PR and fixed outstanding problems
  Removed introduced shadowing bug
  Make aliases share the same memory address as the anchor ( go-yaml#215 )
  Replace LICENSE text with actual license (go-yaml#274)
  Make tag scanning code slightly cleaner.
  move embedded struct example into godoc
  Add UnmarshalStrict returning error if yaml has fields that do not exist in structure
  correct misspell on yamlh.go
  fix misspell on emmiterc.go
  Remove unreachable code to fix go vet (go-yaml#249)
  Fix dead URL for yaml specification (go-yaml#240)
  Tighten restrictions on float decoding (go-yaml#171)
  Fix decode test for Go 1.8 (go-yaml#217)
  Fix unmarshaler handling of empty strings.
  new license in the README file (go-yaml#189)
  ...
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

No branches or pull requests

4 participants