staros/sysconf/example_migration_test.go

28 lines
531 B
Go
Raw Normal View History

package sysconf
import (
"fmt"
"strings"
)
func ExampleNewIni_migration() {
ini := NewIni()
_ = ini.Parse([]byte("[app]\nport=8080\nfeature=alpha\nfeature=beta\n"))
app := ini.Section("app")
_ = app.SetInt("port", 9090, "")
_ = app.SetAll("feature", []string{"stable", "audit"}, "")
fmt.Println(ini.Get("app", "port"))
fmt.Println(ini.GetAll("app", "feature"))
fmt.Println(strings.TrimSpace(string(ini.Build())))
// Output:
// 9090
// [stable audit]
// [app]
// port=9090
// feature=stable
// feature=audit
}