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

Runtime panic on Unmarshal on dictionaries with unhashable keys #25

Closed
ghost opened this issue Aug 26, 2014 · 1 comment
Closed

Runtime panic on Unmarshal on dictionaries with unhashable keys #25

ghost opened this issue Aug 26, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 26, 2014

The following program produces a panic of the form:

panic: runtime error: hash of unhashable type []interface {} [recovered]
panic: runtime error: hash of unhashable type []interface {}


package main
import (
    "fmt"
    "gopkg.in/yaml.v1"
)
func main() {
    var x interface{}
    msg := `{".", ["+"]}`
    yaml.Unmarshal([]byte(msg), &x)
    fmt.Println(x)
}
@ghost
Copy link
Author

ghost commented Aug 26, 2014

Another example that will cause panic:

package main
import (
    "fmt"
    "gopkg.in/yaml.v1"
)
func main() {
    var x interface{}
    msg := `{[]}`
    yaml.Unmarshal([]byte(msg), &x)
    fmt.Println(x)
}

@ghost ghost changed the title Runtime panic on Unmarshal Runtime panic on Unmarshal on dictionaries with unhashable keys Aug 26, 2014
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

0 participants