|
|
|
|
|
by mtlynch
867 days ago
|
|
The problem there is that you lose the guarantee that the parser validated the string value. A caller can just say: // This is returning an error for some reason, so let's do it directly.
// username, err := parsers.NewUsername(raw)
username := parsers.Username(raw)
You also get implicit conversions in ways you probably don't want: var u Username
u = "<hello>" // Implicitly converts from string to Username
|
|