Skip to content

Instantly share code, notes, and snippets.

@taotetek
Created April 17, 2014 14:28
Show Gist options
  • Save taotetek/10987739 to your computer and use it in GitHub Desktop.
Save taotetek/10987739 to your computer and use it in GitHub Desktop.
type Config struct {
Directories []string
Files []string
}
func NewConfig(path string) (*Config, error) {
c := new(Config)
cFile, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
err = json.Unmarshal(cFile, &c)
if err != nil {
return nil, err
}
return c, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment