Skip to content

Instantly share code, notes, and snippets.

@madflojo
Created September 3, 2022 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madflojo/6700bdf205ae0d345d3d6db23967fc86 to your computer and use it in GitHub Desktop.
Save madflojo/6700bdf205ae0d345d3d6db23967fc86 to your computer and use it in GitHub Desktop.
ThreadSafe Packages - SetName
// SetName will change the name of the current Directory.
func (d *Directory) SetName(n string) error {
if n == "" {
return fmt.Errorf("cannot have an empty name")
}
d.Lock()
defer d.Unlock()
d.name = n
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment