Skip to content

Instantly share code, notes, and snippets.

@Cergoo
Last active January 2, 2016 07:09
Show Gist options
  • Save Cergoo/8267793 to your computer and use it in GitHub Desktop.
Save Cergoo/8267793 to your computer and use it in GitHub Desktop.
func (s *Store) openOrCreate(file string) (*os.File, error) {
fname := fmt.Sprintf("%s/%s", s.RootDir, file)
f, e := os.OpenFile(fname, os.O_RDWR^os.O_SYNC^os.O_CREATE, 0600)
if e != nil {
return nil, reterr("openOrCreate", e)
}
return f, nil
}
// truncate a filename extension
langName = item.Name()[:strings.LastIndex(item.Name(), ".")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment