Skip to content

Commit

Permalink
lint: http: Fix 'redefines-builtin-id' error
Browse files Browse the repository at this point in the history
pkg/crc/api/api_http_test.go:120:1: redefines-builtin-id: redefinition of the built-in function delete (revive)
func delete(resource string) request {
	return request{
		httpMethod: http.MethodDelete,
		resource:   resource,
	}
}
  • Loading branch information
cfergeau authored and praveenkumar committed Aug 4, 2023
1 parent 87d6439 commit f95100f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pkg/crc/api/api_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func post(resource string) request {
}
}

func delete(resource string) request {
func deleteRequest(resource string) request {
return request{
httpMethod: http.MethodDelete,
resource: resource,
Expand Down Expand Up @@ -240,7 +240,7 @@ var testCases = []testCase{

// delete
{
request: delete("delete"),
request: deleteRequest("delete"),
response: empty(),
},
{
Expand All @@ -250,7 +250,7 @@ var testCases = []testCase{

// delete with failure
{
request: delete("delete"),
request: deleteRequest("delete"),
failRequest: true,
// error message comes from fakemachine
response: httpError(500).withBody("delete failed\n"),
Expand Down Expand Up @@ -294,7 +294,7 @@ var testCases = []testCase{
response: httpError(500).withBody("invalid character 'x' looking for beginning of value\n"),
},
{
request: delete("config?cpus"),
request: deleteRequest("config?cpus"),
response: httpError(500).withBody("unexpected end of JSON input\n"),
},
{
Expand Down Expand Up @@ -373,13 +373,13 @@ var testCases = []testCase{
var invalidHTTPMethods = []testCase{
// start
{
request: delete("start"),
request: deleteRequest("start"),
response: httpError(404).withBody("Not Found\n"),
},

// stop
{
request: delete("stop"),
request: deleteRequest("stop"),
response: httpError(404).withBody("Not Found\n"),
},

Expand All @@ -389,7 +389,7 @@ var invalidHTTPMethods = []testCase{
response: httpError(404).withBody("Not Found\n"),
},
{
request: delete("poweroff"),
request: deleteRequest("poweroff"),
response: httpError(404).withBody("Not Found\n"),
},

Expand All @@ -399,7 +399,7 @@ var invalidHTTPMethods = []testCase{
response: httpError(404).withBody("Not Found\n"),
},
{
request: delete("status"),
request: deleteRequest("status"),
response: httpError(404).withBody("Not Found\n"),
},

Expand All @@ -415,7 +415,7 @@ var invalidHTTPMethods = []testCase{
response: httpError(404).withBody("Not Found\n"),
},
{
request: delete("version"),
request: deleteRequest("version"),
response: httpError(404).withBody("Not Found\n"),
},

Expand All @@ -425,7 +425,7 @@ var invalidHTTPMethods = []testCase{
response: httpError(404).withBody("Not Found\n"),
},
{
request: delete("webconsoleurl"),
request: deleteRequest("webconsoleurl"),
response: httpError(404).withBody("Not Found\n"),
},

Expand All @@ -435,19 +435,19 @@ var invalidHTTPMethods = []testCase{
response: httpError(404).withBody("Not Found\n"),
},
{
request: delete("logs"),
request: deleteRequest("logs"),
response: httpError(404).withBody("Not Found\n"),
},

// telemetry
{
request: delete("telemetry"),
request: deleteRequest("telemetry"),
response: httpError(404).withBody("Not Found\n"),
},

// pull-secret
{
request: delete("pull-secret"),
request: deleteRequest("pull-secret"),
// other 404 return "not found", and others "404 not found"
response: httpError(404).withBody("Not Found\n"),
},
Expand Down

0 comments on commit f95100f

Please sign in to comment.