Skip to content

Commit

Permalink
chore(lint): relinted
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
  • Loading branch information
fredbi committed Mar 4, 2024
1 parent 4896833 commit 54f3f80
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestConvertFloat32(t *testing.T) {
for _, f := range validFloats {
c, err := ConvertFloat32(FormatFloat32(f))
require.NoError(t, err)
assert.EqualValues(t, f, c)
assert.InDelta(t, f, c, 1e-6)
}
for _, f := range invalidFloats {
_, err := ConvertFloat32(f)
Expand All @@ -69,7 +69,7 @@ func TestConvertFloat64(t *testing.T) {
for _, f := range validFloats {
c, err := ConvertFloat64(FormatFloat64(f))
require.NoError(t, err)
assert.EqualValues(t, f, c)
assert.InDelta(t, f, c, 1e-6)
}
for _, f := range invalidFloats {
_, err := ConvertFloat64(f)
Expand Down
2 changes: 1 addition & 1 deletion initialism_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (m *indexOfInitialisms) add(key string) *indexOfInitialisms {
func (m *indexOfInitialisms) sorted() (result []string) {
m.sortMutex.Lock()
defer m.sortMutex.Unlock()
m.index.Range(func(key, value interface{}) bool {
m.index.Range(func(key, _ interface{}) bool {
k := key.(string)
result = append(result, k)
return true
Expand Down
10 changes: 5 additions & 5 deletions loading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ func TestLoadFromHTTP(t *testing.T) {
_, err := LoadFromFileOrHTTP("httx://12394:abd")
require.Error(t, err)

serv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
serv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
rw.WriteHeader(http.StatusNotFound)
}))
defer serv.Close()

_, err = LoadFromFileOrHTTP(serv.URL)
require.Error(t, err)

ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
rw.WriteHeader(http.StatusOK)
_, _ = rw.Write([]byte("the content"))
}))
Expand Down Expand Up @@ -137,10 +137,10 @@ func TestLoadHTTPBytes(t *testing.T) {
}

func TestLoadStrategy(t *testing.T) {
loader := func(p string) ([]byte, error) {
loader := func(_ string) ([]byte, error) {
return []byte(yamlPetStore), nil
}
remLoader := func(p string) ([]byte, error) {
remLoader := func(_ string) ([]byte, error) {
return []byte("not it"), nil
}

Expand Down Expand Up @@ -187,7 +187,7 @@ func TestLoadStrategyFile(t *testing.T) {
}
}

remLoader := func(p string) ([]byte, error) {
remLoader := func(_ string) ([]byte, error) {
return []byte(thisIsNotIt), nil
}

Expand Down
3 changes: 2 additions & 1 deletion yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package swag

import (
"encoding/json"
"errors"
"fmt"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -50,7 +51,7 @@ func BytesToYAMLDoc(data []byte) (interface{}, error) {
return nil, err
}
if document.Kind != yaml.DocumentNode || len(document.Content) != 1 || document.Content[0].Kind != yaml.MappingNode {
return nil, fmt.Errorf("only YAML documents that are objects are supported")
return nil, errors.New("only YAML documents that are objects are supported")
}
return &document, nil
}
Expand Down
2 changes: 1 addition & 1 deletion yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ name: a string value
assert.Equal(t, json.RawMessage(`{"description":"object created"}`), d)
}

var yamlPestoreServer = func(rw http.ResponseWriter, r *http.Request) {
var yamlPestoreServer = func(rw http.ResponseWriter, _ *http.Request) {
rw.WriteHeader(http.StatusOK)
_, _ = rw.Write([]byte(yamlPetStore))
}
Expand Down

0 comments on commit 54f3f80

Please sign in to comment.