diff --git a/.golangci.yml b/.golangci.yml index 568ce16..7cea1af 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,7 @@ linters: - godox - gosmopolitan - inamedparam - - intrange # disabled while < go1.22 + #- intrange # disabled while < go1.22 - ireturn - lll - musttag diff --git a/default.go b/default.go index 0c9514d..02e1112 100644 --- a/default.go +++ b/default.go @@ -288,7 +288,7 @@ func isValidIPv4(parts []string) bool { if len(digits) > 1 { const maxUint8 = uint64(^uint8(0)) - for i := 0; i < len(digits)-2; i++ { + for i := range len(digits) - 2 { if digits[i] > maxUint8 { return false } diff --git a/default_test.go b/default_test.go index 1fcc256..ab1d422 100644 --- a/default_test.go +++ b/default_test.go @@ -928,7 +928,7 @@ func BenchmarkIsUUID(b *testing.B) { uuid4s := make([]string, 0, sampleSize) uuid5s := make([]string, 0, sampleSize) - for i := 0; i < sampleSize; i++ { + for range sampleSize { seed := []byte(uuid.Must(uuid.NewRandom()).String()) uuids = append(uuids, uuid.Must(uuid.NewRandom()).String()) uuid3s = append(uuid3s, uuid.NewMD5(uuid.NameSpaceURL, seed).String()) @@ -954,8 +954,8 @@ func benchmarkIs(input []string, fn func(string) bool) func(*testing.B) { var isTrue bool b.ReportAllocs() b.ResetTimer() - for i := 0; i < b.N; i++ { - isTrue = fn(input[i%len(input)]) + for b.Loop() { + isTrue = fn(input[b.N%len(input)]) } fmt.Fprintln(io.Discard, isTrue) } diff --git a/go.mod b/go.mod index 6920c97..754c822 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/go-openapi/strfmt require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 - github.com/go-openapi/errors v0.22.2 + github.com/go-openapi/errors v0.22.3 github.com/go-viper/mapstructure/v2 v2.4.0 github.com/google/uuid v1.6.0 github.com/oklog/ulid v1.3.1 diff --git a/go.sum b/go.sum index d8bb4fe..61539b4 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-openapi/errors v0.22.2 h1:rdxhzcBUazEcGccKqbY1Y7NS8FDcMyIRr0934jrYnZg= -github.com/go-openapi/errors v0.22.2/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0= +github.com/go-openapi/errors v0.22.3 h1:k6Hxa5Jg1TUyZnOwV2Lh81j8ayNw5VVYLvKrp4zFKFs= +github.com/go-openapi/errors v0.22.3/go.mod h1:+WvbaBBULWCOna//9B9TbLNGSFOfF8lY9dw4hGiEiKQ= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/time.go b/time.go index e5da7a3..84e2412 100644 --- a/time.go +++ b/time.go @@ -82,7 +82,7 @@ const ( ISO8601TimeWithReducedPrecisionLocaltime = "2006-01-02T15:04" // ISO8601TimeUniversalSortableDateTimePattern represents a ISO8601 universal sortable date time pattern. ISO8601TimeUniversalSortableDateTimePattern = "2006-01-02 15:04:05" - // short form of ISO8601TimeUniversalSortableDateTimePattern + // ISO8601TimeUniversalSortableDateTimePatternShortForm is the short form of ISO8601TimeUniversalSortableDateTimePattern ISO8601TimeUniversalSortableDateTimePatternShortForm = "2006-01-02" // DateTimePattern pattern to match for the date-time format from http://tools.ietf.org/html/rfc3339#section-5.6 DateTimePattern = `^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$` @@ -157,7 +157,7 @@ func (t DateTime) IsZero() bool { return time.Time(t).IsZero() } -// IsUnixZerom returns whether the date time is equivalent to time.Unix(0, 0).UTC(). +// IsUnixZero returns whether the date time is equivalent to time.Unix(0, 0).UTC(). func (t DateTime) IsUnixZero() bool { return time.Time(t).Equal(UnixZero) }