Skip to content

Commit ff196e5

Browse files
committed
fixed linter for duplicate constant string
Signed-off-by: Frederic BIDON <[email protected]>
1 parent 1d1d938 commit ff196e5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

formats_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestStringValidation(t *testing.T) {
6565
}
6666

6767
for _, v := range testCases {
68-
err := FormatOf("id", "body", v.format, v.obj.String(), strfmt.Default)
68+
err := FormatOf(testID, "body", v.format, v.obj.String(), strfmt.Default)
6969
assert.Nil(t, err)
7070
}
7171
}

spec_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import (
3131
"github.com/stretchr/testify/require"
3232
)
3333

34+
const testID = "id"
35+
3436
// Enable long running tests by using cmd line arg,
3537
// Usage: go test ... -args [-enable-long|-enable-go-swagger]
3638
//
@@ -504,7 +506,7 @@ func TestSpec_ValidateParameters(t *testing.T) {
504506
pp.Delete = nil
505507
var nameParams []spec.Parameter
506508
for _, p := range pp.Parameters {
507-
if p.Name == "id" {
509+
if p.Name == testID {
508510
p.Name = "name"
509511
nameParams = append(nameParams, p)
510512
}
@@ -535,7 +537,7 @@ func TestSpec_ValidateParameters(t *testing.T) {
535537
pp.Delete = nil
536538
var nameParams []spec.Parameter
537539
for _, p := range pp.Parameters {
538-
if p.Name == "id" {
540+
if p.Name == testID {
539541
p.Name = "name"
540542
nameParams = append(nameParams, p)
541543
}

0 commit comments

Comments
 (0)