Skip to content

Instantly share code, notes, and snippets.

@lachlan-eagling
Last active July 29, 2023 21:09
Show Gist options
  • Select an option

  • Save lachlan-eagling/ecdb7c51e341529a410b2afa22cb8dbc to your computer and use it in GitHub Desktop.

Select an option

Save lachlan-eagling/ecdb7c51e341529a410b2afa22cb8dbc to your computer and use it in GitHub Desktop.
// UpdateUsername updates username if valid, else returns an error.
func (u *User) UpdateUsername(newUsername string) error {
if err := validateUsername(newUsername); err != nil {
return err
}
u.username = newUsername
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment