diff --git a/.golangci.yml b/.golangci.yml index 7cea1af..1ad5adf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,7 @@ linters: - godox - gosmopolitan - inamedparam - #- intrange # disabled while < go1.22 + - intrange - ireturn - lll - musttag diff --git a/README.md b/README.md index 7b88cec..de5afe1 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,7 @@ List of defined types: - [UUID5](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-5) - [UUID7](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7) - [ULID](https://github.com/ulid/spec) + +## Licensing + +This library ships under the [SPDX-License-Identifier: Apache-2.0](./LICENSE). diff --git a/bson.go b/bson.go index 6088d85..0eec8f6 100644 --- a/bson.go +++ b/bson.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt @@ -72,7 +61,7 @@ func (id *ObjectId) UnmarshalText(data []byte) error { // validation is performe } // Scan read a value from a database driver -func (id *ObjectId) Scan(raw interface{}) error { +func (id *ObjectId) Scan(raw any) error { var data []byte switch v := raw.(type) { case []byte: diff --git a/bson_test.go b/bson_test.go index a4a2c85..d2ef3ec 100644 --- a/bson_test.go +++ b/bson_test.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt diff --git a/conv/date.go b/conv/date.go index b5c3820..5de2274 100644 --- a/conv/date.go +++ b/conv/date.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import "github.com/go-openapi/strfmt" diff --git a/conv/date_test.go b/conv/date_test.go index 85586f4..3a22329 100644 --- a/conv/date_test.go +++ b/conv/date_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import ( diff --git a/conv/default.go b/conv/default.go index 0312612..b87dfb4 100644 --- a/conv/default.go +++ b/conv/default.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import ( diff --git a/conv/default_test.go b/conv/default_test.go index 02fa1a0..94171d5 100644 --- a/conv/default_test.go +++ b/conv/default_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import ( diff --git a/conv/duration.go b/conv/duration.go index ea30132..897a422 100644 --- a/conv/duration.go +++ b/conv/duration.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import "github.com/go-openapi/strfmt" diff --git a/conv/duration_test.go b/conv/duration_test.go index a015936..c3705ab 100644 --- a/conv/duration_test.go +++ b/conv/duration_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import ( diff --git a/conv/time.go b/conv/time.go index 627cd12..e10f5d0 100644 --- a/conv/time.go +++ b/conv/time.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import "github.com/go-openapi/strfmt" diff --git a/conv/time_test.go b/conv/time_test.go index 9196bdb..88b8b67 100644 --- a/conv/time_test.go +++ b/conv/time_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import ( diff --git a/conv/ulid.go b/conv/ulid.go index 112bec3..6ffff13 100644 --- a/conv/ulid.go +++ b/conv/ulid.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import "github.com/go-openapi/strfmt" diff --git a/conv/ulid_test.go b/conv/ulid_test.go index 0bfb797..3f0fb94 100644 --- a/conv/ulid_test.go +++ b/conv/ulid_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package conv import ( diff --git a/date.go b/date.go index b48e701..8aa17b8 100644 --- a/date.go +++ b/date.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt @@ -68,7 +57,7 @@ func (d Date) MarshalText() ([]byte, error) { } // Scan scans a Date value from database driver type. -func (d *Date) Scan(raw interface{}) error { +func (d *Date) Scan(raw any) error { switch v := raw.(type) { case []byte: return d.UnmarshalText(v) diff --git a/date_test.go b/date_test.go index 1083665..8a70e55 100644 --- a/date_test.go +++ b/date_test.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt @@ -66,7 +55,7 @@ func TestDate_Scan(t *testing.T) { ref := time.Now().Truncate(24 * time.Hour).UTC() date, str := Date(ref), ref.Format(RFC3339FullDate) - values := []interface{}{str, []byte(str), ref} + values := []any{str, []byte(str), ref} for _, value := range values { result := Date{} _ = (&result).Scan(value) diff --git a/default.go b/default.go index 04dc364..8a80cfb 100644 --- a/default.go +++ b/default.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt diff --git a/default_test.go b/default_test.go index b39c39a..c97a8fb 100644 --- a/default_test.go +++ b/default_test.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt diff --git a/doc.go b/doc.go index 41aebe6..5825b72 100644 --- a/doc.go +++ b/doc.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 // Package strfmt contains custom string formats // diff --git a/duration.go b/duration.go index 15fcbd5..908c1b0 100644 --- a/duration.go +++ b/duration.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt @@ -152,7 +141,7 @@ func ParseDuration(cand string) (time.Duration, error) { } // Scan reads a Duration value from database driver type. -func (d *Duration) Scan(raw interface{}) error { +func (d *Duration) Scan(raw any) error { switch v := raw.(type) { // TODO: case []byte: // ? case int64: diff --git a/duration_test.go b/duration_test.go index 83f17ab..4df999a 100644 --- a/duration_test.go +++ b/duration_test.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt @@ -87,7 +76,7 @@ func TestIsDuration_Failed(t *testing.T) { func testDurationSQLScanner(t *testing.T, dur time.Duration) { t.Helper() - values := []interface{}{int64(dur), float64(dur)} + values := []any{int64(dur), float64(dur)} for _, value := range values { var result Duration err := result.Scan(value) diff --git a/errors.go b/errors.go index 9a92403..9faa37c 100644 --- a/errors.go +++ b/errors.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package strfmt type strfmtError string diff --git a/format.go b/format.go index 3c3f654..d9d9e04 100644 --- a/format.go +++ b/format.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt diff --git a/format_test.go b/format_test.go index 7611e14..e4577c3 100644 --- a/format_test.go +++ b/format_test.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt diff --git a/hack/coverage b/hack/coverage deleted file mode 100755 index 76d8bfd..0000000 --- a/hack/coverage +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -e -o pipefail - -# Run test coverage on each subdirectories and merge the coverage profile. -echo "mode: ${GOCOVMODE-atomic}" > coverage.txt - -# Standard go tooling behavior is to ignore dirs with leading underscores -# skip generator for race detection and coverage -for dir in $(go list ./...) -do - pth="$GOPATH/src/$dir" - go test -race -timeout 20m -covermode=${GOCOVMODE-atomic} -coverprofile=${pth}/profile.out $dir - if [ -f $pth/profile.out ] - then - cat $pth/profile.out | tail -n +2 >> coverage.txt - rm $pth/profile.out - fi -done - -go tool cover -func coverage.txt \ No newline at end of file diff --git a/ifaces.go b/ifaces.go index ecd7efa..1b9e72c 100644 --- a/ifaces.go +++ b/ifaces.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package strfmt import ( diff --git a/mongo.go b/mongo.go index 0d94bf3..641fed9 100644 --- a/mongo.go +++ b/mongo.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package strfmt import ( diff --git a/mongo_test.go b/mongo_test.go index 18970c7..c3bea1f 100644 --- a/mongo_test.go +++ b/mongo_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package strfmt import ( diff --git a/time.go b/time.go index 0d39237..8085aaf 100644 --- a/time.go +++ b/time.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt @@ -173,7 +162,7 @@ func (t *DateTime) UnmarshalText(text []byte) error { } // Scan scans a DateTime value from database driver type. -func (t *DateTime) Scan(raw interface{}) error { +func (t *DateTime) Scan(raw any) error { // TODO: case int64: and case float64: ? switch v := raw.(type) { case []byte: diff --git a/time_test.go b/time_test.go index 0247f42..b93edb1 100644 --- a/time_test.go +++ b/time_test.go @@ -1,16 +1,5 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 package strfmt diff --git a/ulid.go b/ulid.go index 62ff52b..85c5b53 100644 --- a/ulid.go +++ b/ulid.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package strfmt import ( @@ -27,12 +30,12 @@ type ULID struct { var ( ulidEntropyPool = sync.Pool{ - New: func() interface{} { + New: func() any { return cryptorand.Reader }, } - ULIDScanDefaultFunc = func(raw interface{}) (ULID, error) { + ULIDScanDefaultFunc = func(raw any) (ULID, error) { u := NewULIDZero() switch x := raw.(type) { case nil: @@ -110,7 +113,7 @@ func NewULID() (ULID, error) { } // GetULID returns underlying instance of ULID -func (u *ULID) GetULID() interface{} { +func (u *ULID) GetULID() any { return u.ULID } @@ -125,7 +128,7 @@ func (u *ULID) UnmarshalText(data []byte) error { // validation is performed lat } // Scan reads a value from a database driver -func (u *ULID) Scan(raw interface{}) error { +func (u *ULID) Scan(raw any) error { ul, err := ULIDScanOverrideFunc(raw) if err == nil { *u = ul diff --git a/ulid_test.go b/ulid_test.go index 8e97941..f372740 100644 --- a/ulid_test.go +++ b/ulid_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + package strfmt import ( @@ -155,7 +158,7 @@ func TestFormatULID_Scan(t *testing.T) { ulid2, err := ParseULID(testUlidAlt) require.NoError(t, err) - ULIDScanOverrideFunc = func(raw interface{}) (ULID, error) { + ULIDScanOverrideFunc = func(raw any) (ULID, error) { u := NewULIDZero() switch x := raw.(type) { case [16]byte: