Skip to content

Instantly share code, notes, and snippets.

@ijonas
Last active August 29, 2015 13:57
Show Gist options
  • Save ijonas/9719722 to your computer and use it in GitHub Desktop.
Save ijonas/9719722 to your computer and use it in GitHub Desktop.
Reading in a config file.
if configBytes, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", os.Getenv("HOME"), ".ddknife")); err == nil {
for _, row := range strings.Split(string(configBytes), "\n") {
if tuple := strings.Split(row, "="); len(tuple) == 2 {
configFileSettings[tuple[0]] = tuple[1]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment