Open xweis opened 5 years ago
#config.toml title = "blabla" [servers] [servers.a] ip = "1.1.1.1" dc = "abc" [servers.b] ip = "2.2.2.2" dc = "cba" #main.go type ( WebSiteConfig struct { Title string Servers map[string]Server } ) type Server struct { IP string DC string } func Load() *WebSiteConfig { config := new(WebSiteConfig) multiconfig.NewWithPath(LogPath). MustLoad(config) return config } #error panic: not struct goroutine 1 [running]: github.com/fatih/structs.strctVal(0xc0001c4500, 0xc0001b88f8, 0x16, 0xc0001c4500, 0xc0001b88f8) /Users/Xwei/go/src/github.com/fatih/structs/structs.go:437 +0x12f github.com/fatih/structs.(*Field).FieldOk(0xc0002122d0, 0xc0002143c2, 0x1, 0xc0001ddc80, 0xc0001caa10) /Users/Xwei/go/src/github.com/fatih/structs/field.go:129 +0x98 github.com/fatih/structs.(*Field).Field(0xc0002122d0, 0xc0002143c2, 0x1, 0x157ad93) /Users/Xwei/go/src/github.com/fatih/structs/field.go:109 +0x3f github.com/koding/multiconfig.(*EnvironmentLoader).processField(0xc0001c02a0, 0x1596ef3, 0xd, 0xc0002122d0, 0x157ad93, 0x7, 0x15fa320, 0xc0001b93b0, 0x0, 0x0) /Users/Xwei/go/src/github.com/koding/multiconfig/env.go:61 +0x164 github.com/koding/multiconfig.(*EnvironmentLoader).Load(0xc0001c02a0, 0x15c80e0, 0xc0001b88d0, 0x0, 0x0)
+1, TOML map lead to "panic struct" error