Skip to content

Commit

Permalink
fixed linter for duplicate constant string
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
  • Loading branch information
fredbi committed Dec 27, 2023
1 parent 1d1d938 commit ff196e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion formats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestStringValidation(t *testing.T) {
}

for _, v := range testCases {
err := FormatOf("id", "body", v.format, v.obj.String(), strfmt.Default)
err := FormatOf(testID, "body", v.format, v.obj.String(), strfmt.Default)
assert.Nil(t, err)
}
}
6 changes: 4 additions & 2 deletions spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
"github.com/stretchr/testify/require"
)

const testID = "id"

// Enable long running tests by using cmd line arg,
// Usage: go test ... -args [-enable-long|-enable-go-swagger]
//
Expand Down Expand Up @@ -504,7 +506,7 @@ func TestSpec_ValidateParameters(t *testing.T) {
pp.Delete = nil
var nameParams []spec.Parameter
for _, p := range pp.Parameters {
if p.Name == "id" {
if p.Name == testID {
p.Name = "name"
nameParams = append(nameParams, p)
}
Expand Down Expand Up @@ -535,7 +537,7 @@ func TestSpec_ValidateParameters(t *testing.T) {
pp.Delete = nil
var nameParams []spec.Parameter
for _, p := range pp.Parameters {
if p.Name == "id" {
if p.Name == testID {
p.Name = "name"
nameParams = append(nameParams, p)
}
Expand Down

0 comments on commit ff196e5

Please sign in to comment.