func main() { if flag.NArg() < 1 { flag.Usage() } for _, f := range flag.Args() { var tmp interface{} md, err := confl.DecodeFile(f, &tmp) if err != nil { log.Fatalf("Error in '%s': %s", f, err) } if flagTypes { printTypes(md) } } }
func main() { gou.SetupLogging("debug") gou.SetColorOutput() var config Config if _, err := confl.DecodeFile("example.conf", &config); err != nil { fmt.Println(err) return } fmt.Printf("Title: %s\n", config.Title) fmt.Printf("Hand: %s %s, %s. Born: %s, Deceased? %v\n", config.Hand.Name, config.Hand.Org, config.Hand.Bio, config.Hand.DOB, config.Hand.Deceased) fmt.Printf("Location: %#v\n", config.Location) for name, person := range config.Seenwith { fmt.Printf("Seen With: %s (%s, %s)\n", name, person.Episode, person.Season) } fmt.Printf("Seasons: %v\n", config.Seasons) fmt.Printf("Description: %v\n", config.Description) }