From 8c63be3b9ec4a94c7c79347a1c917c257311205f Mon Sep 17 00:00:00 2001 From: g41797 Date: Tue, 10 Dec 2024 16:06:00 +0200 Subject: [PATCH] Check that the name does not start with a hyphen. --- name.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/name.go b/name.go index 5a85b2d..e655dcf 100644 --- a/name.go +++ b/name.go @@ -33,6 +33,8 @@ func checkName(s string) error { switch { case len(s) == 0: return NameError{s, ErrEmpty} + case s[0] == '-': + return NameError{s, ErrBadChar} case len(s) >= 200: return NameError{s, ErrTooLong} case !containsOnly(s, NameChars):