diff --git a/.golangci.yml b/.golangci.yml index 31480c7..ce7a6ae 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,6 +10,7 @@ linters: - gomodguard_v2 - godox - exhaustruct + - exhaustruct_v5 - nlreturn - nonamedreturns - noinlineerr diff --git a/default.go b/default.go index bcc57e6..9168d05 100644 --- a/default.go +++ b/default.go @@ -119,6 +119,7 @@ func IsHostname(str string) bool { } // IDNA check + str, _ = strings.CutSuffix(str, ".") // tolerates trailing ".", whereas IDNA ValidateLabel rule does not res, err := idnaHostChecker.ToASCII(strings.ToLower(str)) if err != nil || res == "" { return false @@ -1976,7 +1977,7 @@ func isISBN(str string, version int) bool { for i = range isbnVersion13 - 1 { checksum += factor[i%2] * int32(sanitized[i]-'0') } - return (int32(sanitized[isbnVersion13-1]-'0'))-((decimalBase-(checksum%decimalBase))%decimalBase) == 0 + return int32(sanitized[isbnVersion13-1]-'0')-((decimalBase-(checksum%decimalBase))%decimalBase) == 0 default: return isISBN(str, isbnVersion10) || isISBN(str, isbnVersion13) } diff --git a/format.go b/format.go index 09c3754..7ec7856 100644 --- a/format.go +++ b/format.go @@ -122,7 +122,7 @@ func (f *defaultFormats) Add(name string, strfmt Format, validator Validator) bo nme := f.normalizeName(name) tpe := reflect.TypeOf(strfmt) - if tpe.Kind() == reflect.Ptr { + if tpe.Kind() == reflect.Pointer { tpe = tpe.Elem() } @@ -176,7 +176,7 @@ func (f *defaultFormats) DelByFormat(strfmt Format) bool { defer f.Unlock() tpe := reflect.TypeOf(strfmt) - if tpe.Kind() == reflect.Ptr { + if tpe.Kind() == reflect.Pointer { tpe = tpe.Elem() } @@ -208,7 +208,7 @@ func (f *defaultFormats) ContainsFormat(strfmt Format) bool { f.Lock() defer f.Unlock() tpe := reflect.TypeOf(strfmt) - if tpe.Kind() == reflect.Ptr { + if tpe.Kind() == reflect.Pointer { tpe = tpe.Elem() }