package config import ( "fmt" "os" fp "path/filepath" "github.com/BurntSushi/toml" ) const ConfigStr = ` [input] ext = "txt" recurse = true path = "%s" [output] [output.stdout] enabled = true [output.stdout.config] json = false ` func DefaultConfig() (Config, error) { home, _ := os.UserHomeDir() inDir := fp.Join(home, "my-log") s := fmt.Sprintf(ConfigStr, inDir) c := Config{} _, err := toml.Decode(s, &c) return c, err }