Skip to content

Commit

Permalink
fix that test situation (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp authored Mar 10, 2022
1 parent 1b3c813 commit 32d9f54
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@

# IntelliJ / GoLand
.idea

/openapi3/load_with_go_embed_test.go
.vscode
.vscode
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/getkin/kin-openapi

go 1.14
go 1.16

require (
github.com/ghodss/yaml v1.0.0
Expand Down
3 changes: 2 additions & 1 deletion openapi3/external_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package openapi3

import (
"context"
"errors"
"fmt"
"net/url"

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build go1.16
// +build go1.16

package openapi3_test

import (
Expand Down
3 changes: 2 additions & 1 deletion openapi3/request_body.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package openapi3

import (
"context"
"errors"
"fmt"

"github.com/getkin/kin-openapi/jsoninfo"
Expand Down Expand Up @@ -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)
}

0 comments on commit 32d9f54

Please sign in to comment.