package main import ( "gopkg.in/ini.v1" "log" ) type IP struct { Value []string `ini:"value"` } func main() { iniconf := `[IP] value = 192.168.31.201 value = 192.168.31.211 value = 192.168.31.221` cfg, err := ini.ShadowLoad([]byte(iniconf)) if err != nil { log.Fatal(err) } note := new(IP) for _, section := range cfg.Sections() { if err = section.MapTo(note);err != nil { log.Println(err) } else { log.Println(section.Name(), note.Value) } } }