8000
Reproduce script:
package main import ( "bytes" "fmt" "gopkg.in/ini.v1" ) type Struct1 struct { Field1 string } type Struct2 struct { Struct1 } func main() { v := Struct2{Struct1{"foobar"}} cfg := ini.Empty() if err := cfg.ReflectFrom(&v); err != nil { fmt.Printf("Ops: %v", err) } buff := bytes.NewBuffer(nil) cfg.WriteTo(buff) fmt.Println(buff.String()) }
The above gives the following output:
panic: interface conversion: interface is main.Struct1, not time.Time goroutine 1 [running]: panic(0x5166c0, 0x10a6bbe0) C:/GOROOT/src/runtime/panic.go:481 +0x326 gopkg.in/ini%2ev1.reflectWithProperType(0x8d4068, 0x514f20, 0x10a6bbc0, 0x514f20, 0x10a88168, 0x199, 0x52c970, 0x1, 0x0, 0x0) D:/Go/src/gopkg.in/ini.v1/struct.go:318 +0x30a gopkg.in/ini%2ev1.(*Section).reflectFrom(0x10a66390, 0x514f80, 0x10a88168, 0x199, 0x0, 0x0) D:/Go/src/gopkg.in/ini.v1/struct.go:393 +0x72a gopkg.in/ini%2ev1.(*Section).ReflectFrom(0x10a66390, 0x4ebd80, 0x10a88168, 0x0, 0x0) D:/Go/src/gopkg.in/ini.v1/struct.go:412 +0x149 gopkg.in/ini%2ev1.(*File).ReflectFrom(0x10a68580, 0x4ebd80, 0x10a88168, 0x0, 0x0) D:/Go/src/gopkg.in/ini.v1/struct.go:417 +0x51 main.main() C:/Users/andrey.nering/Desktop/ini_reproduce.go:22 +0x93 exit status 2
I guess the error started after 959d90a
I suspect from this and this lines.
Given that reflect.TypeOf(time.Now()).Kind() is struct, so any struct will match that line. See https://play.golang.org/p/16o9O2eDNq
reflect.TypeOf(time.Now()).Kind()
struct
Checkouting to 927d8d7 (one commit before the cited) fixed this issue for me.
Which version of Go?
1.6.2
#61 fix struct check with time.Time
Fix pushed.
Thanks for the fast fix. I'll test when possible and give feedback.
It's working. Thank you very much.
Activity
unknwon commentedon Aug 5, 2016
Which version of Go?
andreynering commentedon Aug 5, 2016
1.6.2
#61 fix struct check with time.Time
unknwon commentedon Aug 5, 2016
Fix pushed.
andreynering commentedon Aug 5, 2016
Thanks for the fast fix. I'll test when possible and give feedback.
andreynering commentedon Aug 6, 2016
It's working. Thank you very much.