We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When a custom type is used, Unpack panics.
Unpack
See the example code:
package main import ( "fmt" "os" "github.com/elastic/go-ucfg" ) type StructWithStringMember struct { Foo string `config:"foo"` } type Custom string type StructWithCustomTypeMember struct { Foo Custom `config:"foo"` } func main() { m := map[string]interface{}{ "foo": "bar", } config, err := ucfg.NewFrom(m) if err != nil { fmt.Println(err) os.Exit(1) } // this works cfg1 := &StructWithStringMember{} if err = config.Unpack(cfg1); err != nil { fmt.Println(err) os.Exit(1) } fmt.Println("works") // // this panics cfg2 := &StructWithCustomTypeMember{} if err = config.Unpack(cfg2); err != nil { fmt.Println(err) os.Exit(1) } // }
This will panic with a message like
panic: reflect.nameFrom: name too long: *************...***********string goroutine 1 [running]: reflect.newName(0xc0cc3b0000, 0x10000, 0x0, 0x0, 0x0, 0xc0cc3b0000) /usr/local/Cellar/go/1.14.3/libexec/src/reflect/type.go:529 +0x2e0 reflect.(*rtype).ptrTo(0xc0041c1e00, 0xc003f30068) /usr/local/Cellar/go/1.14.3/libexec/src/reflect/type.go:1406 +0x20c reflect.New(0x1195260, 0xc0041c1e00, 0x16, 0x1195260, 0xc0041c1e00) /usr/local/Cellar/go/1.14.3/libexec/src/reflect/value.go:2356 +0x5d github.com/elastic/go-ucfg.pointerize(0x1195260, 0x11307c0, 0x1195260, 0x1130dc0, 0x1130dc0, 0xc000010550, 0x98, 0x198, 0x1194e80, 0xc000110080) /Users/marcguasch/go/src/github.com/elastic/go-ucfg/util.go:141 +0x11d github.com/elastic/go-ucfg.reifyGetField(0xc000078270, 0xc00011a120, 0x0, 0x0, 0x0, 0x0, 0x1123b1c, 0x3, 0x11307c0, 0xc000010500, ...) /Users/marcguasch/go/src/github.com/elastic/go-ucfg/reify.go:354 +0x416 github.com/elastic/go-ucfg.reifyStruct(0xc00011a120, 0x1141f80, 0xc0000104e0, 0x199, 0xc000078270, 0x0, 0x0) /Users/marcguasch/go/src/github.com/elastic/go-ucfg/reify.go:292 +0xa03 github.com/elastic/go-ucfg.reifyInto(0xc00011a120, 0x1129fc0, 0xc0000104e0, 0x16, 0xc000078270, 0x10, 0x1141f80) /Users/marcguasch/go/src/github.com/elastic/go-ucfg/reify.go:177 +0x40c github.com/elastic/go-ucfg.(*Config).Unpack(0xc000078270, 0x1129fc0, 0xc0000104e0, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/marcguasch/go/src/github.com/elastic/go-ucfg/reify.go:155 +0xf5 main.main() /Users/marcguasch/go/src/github.com/elastic/go-ucfg/ex/main.go:39 +0x289 exit status 2
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
When a custom type is used,
Unpack
panics.See the example code:
This will panic with a message like
The text was updated successfully, but these errors were encountered: