Skip to content

Instantly share code, notes, and snippets.

@ahl
Created August 7, 2016 03:37
Show Gist options
  • Save ahl/f99a75c90da8d44b61c6c78938f5438e to your computer and use it in GitHub Desktop.
Save ahl/f99a75c90da8d44b61c6c78938f5438e to your computer and use it in GitHub Desktop.
nomsfs blog: mkdir.go
func (fs *nomsFS) mkdir(dir types.Struct, pathComponents []string) types.Struct {
if len(pathComponents) > 0 {
name := pathComponents[0]
return dir.Set(name, fs.mkdir(dir.Get(name).(types.Struct), pathComponents[1:]))
} else {
return types.NewStructWithType(directoryType, types.ValueSlice{types.NewMap()})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment