Repository: getkin/kin-openapi
Pull request #506 (2022-03-10 09:21:42)

fix that test situation
Since https://github.com/deepmap/oapi-codegen/pull/322#issuecomment-805192283 the project has moved on from go1.14



Patch:
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 4a5b87c..6fa60a5 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -12,12 +12,11 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        go: ['1.14', '1.x']
-        # Locked at https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
+        go: ['1.16', '1.x']
         os:
-        - ubuntu-20.04
-        - windows-2019
-        - macos-10.15
+        - ubuntu-latest
+        - windows-latest
+        - macos-latest
     runs-on: ${{ matrix.os }}
     defaults:
       run:
@@ -47,8 +46,6 @@ jobs:
       with:
         path: ${{ steps.go-cache-paths.outputs.go-mod }}
         key: ${{ runner.os }}-go-${{ matrix.go }}-mod-${{ hashFiles('**/go.sum') }}
-      if: matrix.go != '1.14'
-
 
     - uses: actions/checkout@v2
 
@@ -70,12 +67,6 @@ jobs:
         CGO_ENABLED: '1'
     - if: runner.os == 'Linux'
       run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
-    - run: |
-        cp openapi3/testdata/load_with_go_embed_test.go openapi3/
-        cat go.mod | sed 's%go 1.14%go 1.16%' >gomod && mv gomod go.mod
-        go test ./...
-      if: matrix.go != '1.14'
-
 
     - if: runner.os == 'Linux'
       name: Errors must not be capitalized https://github.com/golang/go/wiki/CodeReviewComments#error-strings
diff --git a/.gitignore b/.gitignore
index 1a3ec37..40b6711 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,4 @@
 
  # IntelliJ / GoLand
 .idea
-
-/openapi3/load_with_go_embed_test.go
-.vscode
\ No newline at end of file
+.vscode
diff --git a/go.mod b/go.mod
index 9da0ae5..df32d6a 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/getkin/kin-openapi
 
-go 1.14
+go 1.16
 
 require (
 	github.com/ghodss/yaml v1.0.0
diff --git a/openapi3/external_docs.go b/openapi3/external_docs.go
index e57f18a..5ea4d45 100644
--- a/openapi3/external_docs.go
+++ b/openapi3/external_docs.go
@@ -2,6 +2,7 @@ package openapi3
 
 import (
 	"context"
+	"errors"
 	"fmt"
 	"net/url"
 
@@ -26,7 +27,7 @@ func (e *ExternalDocs) UnmarshalJSON(data []byte) error {
 
 func (e *ExternalDocs) Validate(ctx context.Context) error {
 	if e.URL == "" {
-		return fmt.Errorf("url is required")
+		return errors.New("url is required")
 	}
 	if _, err := url.Parse(e.URL); err != nil {
 		return fmt.Errorf("url is incorrect: %w", err)
diff --git a/openapi3/request_body.go b/openapi3/request_body.go
index b0ae831..a1a8ac5 100644
--- a/openapi3/request_body.go
+++ b/openapi3/request_body.go
@@ -2,6 +2,7 @@ package openapi3
 
 import (
 	"context"
+	"errors"
 	"fmt"
 
 	"github.com/getkin/kin-openapi/jsoninfo"
@@ -99,7 +100,7 @@ func (requestBody *RequestBody) UnmarshalJSON(data []byte) error {
 
 func (value *RequestBody) Validate(ctx context.Context) error {
 	if value.Content == nil {
-		return fmt.Errorf("content of the request body is required")
+		return errors.New("content of the request body is required")
 	}
 	return value.Content.Validate(ctx)
 }


Test patch:
diff --git a/openapi3/testdata/load_with_go_embed_test.go b/openapi3/load_with_go_embed_test.go
similarity index 95%
rename from openapi3/testdata/load_with_go_embed_test.go
rename to openapi3/load_with_go_embed_test.go
index 56b274c..e0fb915 100644
--- a/openapi3/testdata/load_with_go_embed_test.go
+++ b/openapi3/load_with_go_embed_test.go
@@ -1,3 +1,6 @@
+//go:build go1.16
+// +build go1.16
+
 package openapi3_test
 
 import (