MCPcopy Index your code
hub / github.com/coder/coder / UserRealNameValid

Function UserRealNameValid

codersdk/name.go:90–99  ·  view source on GitHub ↗

UserRealNameValid returns whether the input string is a valid real user name.

(str string)

Source from the content-addressed store, hash-verified

88
89// UserRealNameValid returns whether the input string is a valid real user name.
90func UserRealNameValid(str string) error {
91 if len(str) > 128 {
92 return xerrors.New("must be <= 128 characters")
93 }
94
95 if strings.TrimSpace(str) != str {
96 return xerrors.New("must not have leading or trailing whitespace")
97 }
98 return nil
99}
100
101// GroupNameValid returns whether the input string is a valid group name.
102func GroupNameValid(str string) error {

Callers 2

initFunction · 0.92
TestUserRealNameValidFunction · 0.92

Calls 1

NewMethod · 0.65

Tested by 1

TestUserRealNameValidFunction · 0.74