Last active
July 29, 2023 21:09
-
-
Save lachlan-eagling/ecdb7c51e341529a410b2afa22cb8dbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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