I want to write the conf out to myconfig.gcfg, when I load the file and has change the Name string. How should I do? Sample config:
[Span]
Name = "DuraSpan"
MySpan = 4
[Sys]
SerialName = "/dev/ttyS0"
Go code:
import "gopkg.in/gcfg.v1"
type Config struct {
Span struct {
Name string
MySpan int
}
Sys struct{
SerialName string
}
}
var conf Config
err := gcfg.ReadFileInto(&conf, "myconfig.gcfg")
conf.Span.MySpan = 6
how to write back the change to file?