Skip to content

Commit 1dccc8d

Browse files
Merge pull request #3262 from gophercloud/bp-v2-eaf2923-ce56d12-0d4b68d
[v2] Address govet 1.24 issue
2 parents b8089e5 + 752f35e commit 1dccc8d

File tree

184 files changed

+897
-891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+897
-891
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
undefine GOFLAGS
22

3-
GOLANGCI_LINT_VERSION?=v1.57.1
4-
GO_TEST?=go run gotest.tools/gotestsum@latest --format testname
3+
GOLANGCI_LINT_VERSION?=v1.62.2
4+
GO_TEST?=go run gotest.tools/gotestsum@latest --format testname --
55

66
ifeq ($(shell command -v podman 2> /dev/null),)
77
RUNNER=docker
@@ -23,7 +23,7 @@ lint:
2323
-v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache \
2424
-w /app \
2525
-e GOFLAGS="-tags=acceptance" \
26-
golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint run
26+
golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint run -v --max-same-issues 50
2727
.PHONY: lint
2828

2929
format:

internal/acceptance/clients/clients.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,14 @@ func AcceptanceTestChoicesFromEnv() (*AcceptanceTestChoices, error) {
107107
notDistinct = "OS_FLAVOR_ID and OS_FLAVOR_ID_RESIZE must be distinct."
108108
}
109109

110-
if len(missing) > 0 || notDistinct != "" {
111-
text := "You're missing some important setup:\n"
112-
if len(missing) > 0 {
113-
text += " * These environment variables must be provided: " + strings.Join(missing, ", ") + "\n"
114-
}
115-
if notDistinct != "" {
116-
text += " * " + notDistinct + "\n"
117-
}
110+
if len(missing) > 0 {
111+
text := "You're missing some important setup:\n * These environment variables must be provided: %s\n"
112+
return nil, fmt.Errorf(text, strings.Join(missing, ", "))
113+
}
118114

119-
return nil, fmt.Errorf(text)
115+
if notDistinct != "" {
116+
text := "You're missing some important setup:\n * %s\n"
117+
return nil, fmt.Errorf(text, notDistinct)
120118
}
121119

122120
return &AcceptanceTestChoices{

internal/acceptance/tools/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ func Elide(value string) string {
8181
// PrintResource returns a resource as a readable structure
8282
func PrintResource(t *testing.T, resource any) {
8383
b, _ := json.MarshalIndent(resource, "", " ")
84-
t.Logf(string(b))
84+
t.Log(string(b))
8585
}

openstack/baremetal/apiversions/testing/fixtures_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func MockListResponse(t *testing.T) {
8989
w.Header().Add("Content-Type", "application/json")
9090
w.WriteHeader(http.StatusOK)
9191

92-
fmt.Fprintf(w, IronicAPIAllVersionResponse)
92+
fmt.Fprint(w, IronicAPIAllVersionResponse)
9393
})
9494
}
9595

@@ -101,6 +101,6 @@ func MockGetResponse(t *testing.T) {
101101
w.Header().Add("Content-Type", "application/json")
102102
w.WriteHeader(http.StatusOK)
103103

104-
fmt.Fprintf(w, IronicAPIVersionResponse)
104+
fmt.Fprint(w, IronicAPIVersionResponse)
105105
})
106106
}

openstack/baremetal/v1/allocations/testing/fixtures_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ func HandleAllocationListSuccessfully(t *testing.T) {
120120
marker := r.Form.Get("marker")
121121
switch marker {
122122
case "":
123-
fmt.Fprintf(w, AllocationListBody)
123+
fmt.Fprint(w, AllocationListBody)
124124

125125
case "eff80f47-75f0-4d41-b1aa-cf07c201adac":
126-
fmt.Fprintf(w, `{ "allocations": [] }`)
126+
fmt.Fprint(w, `{ "allocations": [] }`)
127127
default:
128128
t.Fatalf("/allocations invoked with unexpected marker=[%s]", marker)
129129
}
@@ -145,7 +145,7 @@ func HandleAllocationCreationSuccessfully(t *testing.T, response string) {
145145

146146
w.WriteHeader(http.StatusAccepted)
147147
w.Header().Add("Content-Type", "application/json")
148-
fmt.Fprintf(w, response)
148+
fmt.Fprint(w, response)
149149
})
150150
}
151151

@@ -165,6 +165,6 @@ func HandleAllocationGetSuccessfully(t *testing.T) {
165165
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
166166
th.TestHeader(t, r, "Accept", "application/json")
167167

168-
fmt.Fprintf(w, SingleAllocationBody)
168+
fmt.Fprint(w, SingleAllocationBody)
169169
})
170170
}

openstack/baremetal/v1/conductors/testing/fixtures_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ func HandleConductorListSuccessfully(t *testing.T) {
150150
marker := r.Form.Get("marker")
151151
switch marker {
152152
case "":
153-
fmt.Fprintf(w, ConductorListBody)
153+
fmt.Fprint(w, ConductorListBody)
154154

155155
case "9e5476bd-a4ec-4653-93d6-72c93aa682ba":
156-
fmt.Fprintf(w, `{ "servers": [] }`)
156+
fmt.Fprint(w, `{ "servers": [] }`)
157157
default:
158158
t.Fatalf("/conductors invoked with unexpected marker=[%s]", marker)
159159
}
@@ -170,7 +170,7 @@ func HandleConductorListDetailSuccessfully(t *testing.T) {
170170
t.Errorf("Failed to parse request form %v", err)
171171
}
172172

173-
fmt.Fprintf(w, ConductorListDetailBody)
173+
fmt.Fprint(w, ConductorListDetailBody)
174174
})
175175
}
176176

@@ -180,6 +180,6 @@ func HandleConductorGetSuccessfully(t *testing.T) {
180180
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
181181
th.TestHeader(t, r, "Accept", "application/json")
182182

183-
fmt.Fprintf(w, SingleConductorBody)
183+
fmt.Fprint(w, SingleConductorBody)
184184
})
185185
}

openstack/baremetal/v1/drivers/testing/fixtures_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func HandleListDriversSuccessfully(t *testing.T) {
377377
t.Errorf("Failed to parse request form %v", err)
378378
}
379379

380-
fmt.Fprintf(w, ListDriversBody)
380+
fmt.Fprint(w, ListDriversBody)
381381
})
382382
}
383383

@@ -388,7 +388,7 @@ func HandleGetDriverDetailsSuccessfully(t *testing.T) {
388388
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
389389
th.TestHeader(t, r, "Accept", "application/json")
390390

391-
fmt.Fprintf(w, SingleDriverDetails)
391+
fmt.Fprint(w, SingleDriverDetails)
392392
})
393393
}
394394

@@ -399,7 +399,7 @@ func HandleGetDriverPropertiesSuccessfully(t *testing.T) {
399399
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
400400
th.TestHeader(t, r, "Accept", "application/json")
401401

402-
fmt.Fprintf(w, SingleDriverProperties)
402+
fmt.Fprint(w, SingleDriverProperties)
403403
})
404404
}
405405

@@ -410,6 +410,6 @@ func HandleGetDriverDiskPropertiesSuccessfully(t *testing.T) {
410410
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
411411
th.TestHeader(t, r, "Accept", "application/json")
412412

413-
fmt.Fprintf(w, SingleDriverDiskProperties)
413+
fmt.Fprint(w, SingleDriverDiskProperties)
414414
})
415415
}

openstack/baremetal/v1/nodes/testing/fixtures_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,10 +1409,10 @@ func HandleNodeListSuccessfully(t *testing.T) {
14091409
marker := r.Form.Get("marker")
14101410
switch marker {
14111411
case "":
1412-
fmt.Fprintf(w, NodeListBody)
1412+
fmt.Fprint(w, NodeListBody)
14131413

14141414
case "9e5476bd-a4ec-4653-93d6-72c93aa682ba":
1415-
fmt.Fprintf(w, `{ "servers": [] }`)
1415+
fmt.Fprint(w, `{ "servers": [] }`)
14161416
default:
14171417
t.Fatalf("/nodes invoked with unexpected marker=[%s]", marker)
14181418
}
@@ -1429,7 +1429,7 @@ func HandleNodeListDetailSuccessfully(t *testing.T) {
14291429
t.Errorf("Failed to parse request form %v", err)
14301430
}
14311431

1432-
fmt.Fprintf(w, NodeListDetailBody)
1432+
fmt.Fprint(w, NodeListDetailBody)
14331433
})
14341434
}
14351435

@@ -1456,7 +1456,7 @@ func HandleNodeCreationSuccessfully(t *testing.T, response string) {
14561456

14571457
w.WriteHeader(http.StatusAccepted)
14581458
w.Header().Add("Content-Type", "application/json")
1459-
fmt.Fprintf(w, response)
1459+
fmt.Fprint(w, response)
14601460
})
14611461
}
14621462

@@ -1476,7 +1476,7 @@ func HandleNodeGetSuccessfully(t *testing.T) {
14761476
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
14771477
th.TestHeader(t, r, "Accept", "application/json")
14781478

1479-
fmt.Fprintf(w, SingleNodeBody)
1479+
fmt.Fprint(w, SingleNodeBody)
14801480
})
14811481
}
14821482

@@ -1488,7 +1488,7 @@ func HandleNodeUpdateSuccessfully(t *testing.T, response string) {
14881488
th.TestHeader(t, r, "Content-Type", "application/json")
14891489
th.TestJSONRequest(t, r, `[{"op": "replace", "path": "/properties", "value": {"root_gb": 25}}]`)
14901490

1491-
fmt.Fprintf(w, response)
1491+
fmt.Fprint(w, response)
14921492
})
14931493
}
14941494

@@ -1498,7 +1498,7 @@ func HandleNodeValidateSuccessfully(t *testing.T) {
14981498
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
14991499
th.TestHeader(t, r, "Accept", "application/json")
15001500

1501-
fmt.Fprintf(w, NodeValidationBody)
1501+
fmt.Fprint(w, NodeValidationBody)
15021502
})
15031503
}
15041504

@@ -1530,7 +1530,7 @@ func HandleGetBootDeviceSuccessfully(t *testing.T) {
15301530
th.TestMethod(t, r, "GET")
15311531
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
15321532
w.WriteHeader(http.StatusOK)
1533-
fmt.Fprintf(w, NodeBootDeviceBody)
1533+
fmt.Fprint(w, NodeBootDeviceBody)
15341534
})
15351535
}
15361536

@@ -1540,7 +1540,7 @@ func HandleGetSupportedBootDeviceSuccessfully(t *testing.T) {
15401540
th.TestMethod(t, r, "GET")
15411541
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
15421542
w.WriteHeader(http.StatusOK)
1543-
fmt.Fprintf(w, NodeSupportedBootDeviceBody)
1543+
fmt.Fprint(w, NodeSupportedBootDeviceBody)
15441544
})
15451545
}
15461546

@@ -1672,7 +1672,7 @@ func HandleListBIOSSettingsSuccessfully(t *testing.T) {
16721672
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
16731673
th.TestHeader(t, r, "Accept", "application/json")
16741674

1675-
fmt.Fprintf(w, NodeBIOSSettingsBody)
1675+
fmt.Fprint(w, NodeBIOSSettingsBody)
16761676
})
16771677
}
16781678

@@ -1682,7 +1682,7 @@ func HandleListDetailBIOSSettingsSuccessfully(t *testing.T) {
16821682
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
16831683
th.TestHeader(t, r, "Accept", "application/json")
16841684

1685-
fmt.Fprintf(w, NodeDetailBIOSSettingsBody)
1685+
fmt.Fprint(w, NodeDetailBIOSSettingsBody)
16861686
})
16871687
}
16881688

@@ -1692,7 +1692,7 @@ func HandleGetBIOSSettingSuccessfully(t *testing.T) {
16921692
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
16931693
th.TestHeader(t, r, "Accept", "application/json")
16941694

1695-
fmt.Fprintf(w, NodeSingleBIOSSettingBody)
1695+
fmt.Fprint(w, NodeSingleBIOSSettingBody)
16961696
})
16971697
}
16981698

@@ -1702,7 +1702,7 @@ func HandleGetVendorPassthruMethodsSuccessfully(t *testing.T) {
17021702
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
17031703
th.TestHeader(t, r, "Accept", "application/json")
17041704

1705-
fmt.Fprintf(w, NodeVendorPassthruMethodsBody)
1705+
fmt.Fprint(w, NodeVendorPassthruMethodsBody)
17061706
})
17071707
}
17081708

@@ -1713,7 +1713,7 @@ func HandleGetAllSubscriptionsVendorPassthruSuccessfully(t *testing.T) {
17131713
th.TestHeader(t, r, "Accept", "application/json")
17141714
th.TestFormValues(t, r, map[string]string{"method": "get_all_subscriptions"})
17151715

1716-
fmt.Fprintf(w, NodeGetAllSubscriptionsVnedorPassthruBody)
1716+
fmt.Fprint(w, NodeGetAllSubscriptionsVnedorPassthruBody)
17171717
})
17181718
}
17191719

@@ -1729,7 +1729,7 @@ func HandleGetSubscriptionVendorPassthruSuccessfully(t *testing.T) {
17291729
}
17301730
`)
17311731

1732-
fmt.Fprintf(w, NodeGetSubscriptionVendorPassthruBody)
1732+
fmt.Fprint(w, NodeGetSubscriptionVendorPassthruBody)
17331733
})
17341734
}
17351735

@@ -1749,7 +1749,7 @@ func HandleCreateSubscriptionVendorPassthruAllParametersSuccessfully(t *testing.
17491749
}
17501750
`)
17511751

1752-
fmt.Fprintf(w, NodeCreateSubscriptionVendorPassthruAllParametersBody)
1752+
fmt.Fprint(w, NodeCreateSubscriptionVendorPassthruAllParametersBody)
17531753
})
17541754
}
17551755

@@ -1765,7 +1765,7 @@ func HandleCreateSubscriptionVendorPassthruRequiredParametersSuccessfully(t *tes
17651765
}
17661766
`)
17671767

1768-
fmt.Fprintf(w, NodeCreateSubscriptionVendorPassthruRequiredParametersBody)
1768+
fmt.Fprint(w, NodeCreateSubscriptionVendorPassthruRequiredParametersBody)
17691769
})
17701770
}
17711771

@@ -1810,7 +1810,7 @@ func HandleGetInventorySuccessfully(t *testing.T) {
18101810
th.TestMethod(t, r, "GET")
18111811
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
18121812
w.WriteHeader(http.StatusOK)
1813-
fmt.Fprintf(w, NodeInventoryBody)
1813+
fmt.Fprint(w, NodeInventoryBody)
18141814
})
18151815
}
18161816

@@ -1820,7 +1820,7 @@ func HandleListFirmwareSuccessfully(t *testing.T) {
18201820
th.TestMethod(t, r, "GET")
18211821
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
18221822
w.WriteHeader(http.StatusOK)
1823-
fmt.Fprintf(w, NodeFirmwareListBody)
1823+
fmt.Fprint(w, NodeFirmwareListBody)
18241824
})
18251825
}
18261826

openstack/baremetal/v1/ports/testing/fixtures_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ func HandlePortListSuccessfully(t *testing.T) {
181181
marker := r.Form.Get("marker")
182182
switch marker {
183183
case "":
184-
fmt.Fprintf(w, PortListBody)
184+
fmt.Fprint(w, PortListBody)
185185

186186
case "f2845e11-dbd4-4728-a8c0-30d19f48924a":
187-
fmt.Fprintf(w, `{ "ports": [] }`)
187+
fmt.Fprint(w, `{ "ports": [] }`)
188188
default:
189189
t.Fatalf("/ports invoked with unexpected marker=[%s]", marker)
190190
}
@@ -201,7 +201,7 @@ func HandlePortListDetailSuccessfully(t *testing.T) {
201201
t.Errorf("Failed to parse request form %v", err)
202202
}
203203

204-
fmt.Fprintf(w, PortListDetailBody)
204+
fmt.Fprint(w, PortListDetailBody)
205205
})
206206
}
207207

@@ -219,7 +219,7 @@ func HandlePortCreationSuccessfully(t *testing.T, response string) {
219219

220220
w.WriteHeader(http.StatusAccepted)
221221
w.Header().Add("Content-Type", "application/json")
222-
fmt.Fprintf(w, response)
222+
fmt.Fprint(w, response)
223223
})
224224
}
225225

@@ -239,7 +239,7 @@ func HandlePortGetSuccessfully(t *testing.T) {
239239
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
240240
th.TestHeader(t, r, "Accept", "application/json")
241241

242-
fmt.Fprintf(w, SinglePortBody)
242+
fmt.Fprint(w, SinglePortBody)
243243
})
244244
}
245245

@@ -251,6 +251,6 @@ func HandlePortUpdateSuccessfully(t *testing.T, response string) {
251251
th.TestHeader(t, r, "Content-Type", "application/json")
252252
th.TestJSONRequest(t, r, `[{"op": "replace", "path": "/address", "value": "22:22:22:22:22:22"}]`)
253253

254-
fmt.Fprintf(w, response)
254+
fmt.Fprint(w, response)
255255
})
256256
}

0 commit comments

Comments
 (0)