Skip to content

Commit 32d9f54

Browse files
authored
fix that test situation (#506)
1 parent 1b3c813 commit 32d9f54

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

.github/workflows/go.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
go: ['1.14', '1.x']
16-
# Locked at https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
15+
go: ['1.16', '1.x']
1716
os:
18-
- ubuntu-20.04
19-
- windows-2019
20-
- macos-10.15
17+
- ubuntu-latest
18+
- windows-latest
19+
- macos-latest
2120
runs-on: ${{ matrix.os }}
2221
defaults:
2322
run:
@@ -47,8 +46,6 @@ jobs:
4746
with:
4847
path: ${{ steps.go-cache-paths.outputs.go-mod }}
4948
key: ${{ runner.os }}-go-${{ matrix.go }}-mod-${{ hashFiles('**/go.sum') }}
50-
if: matrix.go != '1.14'
51-
5249

5350
- uses: actions/checkout@v2
5451

@@ -70,12 +67,6 @@ jobs:
7067
CGO_ENABLED: '1'
7168
- if: runner.os == 'Linux'
7269
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
73-
- run: |
74-
cp openapi3/testdata/load_with_go_embed_test.go openapi3/
75-
cat go.mod | sed 's%go 1.14%go 1.16%' >gomod && mv gomod go.mod
76-
go test ./...
77-
if: matrix.go != '1.14'
78-
7970

8071
- if: runner.os == 'Linux'
8172
name: Errors must not be capitalized https://github.com/golang/go/wiki/CodeReviewComments#error-strings

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,4 @@
1818

1919
# IntelliJ / GoLand
2020
.idea
21-
22-
/openapi3/load_with_go_embed_test.go
23-
.vscode
21+
.vscode

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/getkin/kin-openapi
22

3-
go 1.14
3+
go 1.16
44

55
require (
66
github.com/ghodss/yaml v1.0.0

openapi3/external_docs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package openapi3
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"net/url"
78

@@ -26,7 +27,7 @@ func (e *ExternalDocs) UnmarshalJSON(data []byte) error {
2627

2728
func (e *ExternalDocs) Validate(ctx context.Context) error {
2829
if e.URL == "" {
29-
return fmt.Errorf("url is required")
30+
return errors.New("url is required")
3031
}
3132
if _, err := url.Parse(e.URL); err != nil {
3233
return fmt.Errorf("url is incorrect: %w", err)

openapi3/testdata/load_with_go_embed_test.go renamed to openapi3/load_with_go_embed_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build go1.16
2+
// +build go1.16
3+
14
package openapi3_test
25

36
import (

openapi3/request_body.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package openapi3
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67

78
"github.com/getkin/kin-openapi/jsoninfo"
@@ -99,7 +100,7 @@ func (requestBody *RequestBody) UnmarshalJSON(data []byte) error {
99100

100101
func (value *RequestBody) Validate(ctx context.Context) error {
101102
if value.Content == nil {
102-
return fmt.Errorf("content of the request body is required")
103+
return errors.New("content of the request body is required")
103104
}
104105
return value.Content.Validate(ctx)
105106
}

0 commit comments

Comments
 (0)