Skip to content

Commit 13455f4

Browse files
authored
CLOUDP-105826: [mongocli] Update golangci-lint to 1.43 (#129)
1 parent ef28518 commit 13455f4

15 files changed

+18
-30
lines changed

.github/workflows/pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: lint
1616
uses: golangci/golangci-lint-action@v2
1717
with:
18-
version: v1.42.0
18+
version: v1.43.0
1919

2020
tests-on-unix:
2121
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
22

33
SOURCE_FILES?=./...
4-
GOLANGCI_VERSION=v1.42.0
4+
GOLANGCI_VERSION=v1.43.0
55
COVERAGE=coverage.out
66

77
export PATH := ./bin:$(PATH)

opsmngr/accesslist_api_keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
atlas "go.mongodb.org/atlas/mongodbatlas"
2323
)
2424

25-
const accessListAPIKeysPath = "api/public/v1.0/orgs/%s/apiKeys/%s/accessList"
25+
const accessListAPIKeysPath = "api/public/v1.0/orgs/%s/apiKeys/%s/accessList" //nolint:gosec // This is a path
2626

2727
// AccessListAPIKeysServiceOp handles communication with the AccessList API keys related methods of the MongoDB Ops Manager API.
2828
type AccessListAPIKeysServiceOp service

opsmngr/accesslist_api_keys_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
const (
28-
apiKeyID = "API-KEY-ID"
28+
apiKeyID = "API-KEY-ID" //nolint:gosec // ID and not an actual key
2929
ipAddress = "IP-ADDRESS"
3030
)
3131

opsmngr/agents_api_keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
const (
26-
agentAPIKeysBasePath = "api/public/v1.0/groups/%s/agentapikeys"
26+
agentAPIKeysBasePath = "api/public/v1.0/groups/%s/agentapikeys" //nolint:gosec // This is a path
2727
)
2828

2929
// AgentAPIKey defines the structure for an Agent API key.

opsmngr/global_api_key_whitelists.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
atlas "go.mongodb.org/atlas/mongodbatlas"
2323
)
2424

25-
const whitelistAPIKeysPath = "api/public/v1.0/admin/whitelist"
25+
const whitelistAPIKeysPath = "api/public/v1.0/admin/whitelist" //nolint:gosec // This is a path
2626

2727
// GlobalAPIKeyWhitelistsService provides access to the global alerts related functions in the Ops Manager API.
2828
//

opsmngr/global_api_keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
atlas "go.mongodb.org/atlas/mongodbatlas"
2424
)
2525

26-
const apiKeysPath = "api/public/v1.0/admin/apiKeys"
26+
const apiKeysPath = "api/public/v1.0/admin/apiKeys" //nolint:gosec // This is a path
2727

2828
// GlobalAPIKeysService provides access to the global alerts related functions in the Ops Manager API.
2929
//

opsmngr/global_api_keys_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ import (
2626
)
2727

2828
const (
29-
apiDesc = "test-apikeye"
30-
ewmaqvdo = "ewmaqvdo"
31-
testAPIKey = "test-apikey"
29+
apiDesc = "test-apikeye"
30+
ewmaqvdo = "ewmaqvdo"
31+
testAPIKey = "test-apikey"
32+
globalAPIKeyID = "5c47503320eef5699e1cce8d" //nolint:gosec // ID and not an actual key
3233
)
3334

34-
const globalAPIKeyID = "5c47503320eef5699e1cce8d"
35-
3635
func TestAPIKeys_ListAPIKeys(t *testing.T) {
3736
client, mux, teardown := setup()
3837
defer teardown()

opsmngr/opsmngr.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"errors"
2222
"fmt"
2323
"io"
24-
"io/ioutil"
2524
"net/http"
2625
"net/url"
2726
"reflect"
@@ -352,7 +351,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
352351
// won't reuse it anyway.
353352
const maxBodySlurpSize = 2 << 10
354353
if resp.ContentLength == -1 || resp.ContentLength <= maxBodySlurpSize {
355-
_, _ = io.CopyN(ioutil.Discard, resp.Body, maxBodySlurpSize)
354+
_, _ = io.CopyN(io.Discard, resp.Body, maxBodySlurpSize)
356355
}
357356

358357
resp.Body.Close()
@@ -375,7 +374,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
375374
}
376375

377376
response.Raw = raw.Bytes()
378-
body = ioutil.NopCloser(raw)
377+
body = io.NopCloser(raw)
379378
}
380379

381380
if v != nil {

opsmngr/opsmngr_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"encoding/json"
2020
"errors"
2121
"fmt"
22-
"io/ioutil"
22+
"io"
2323
"net/http"
2424
"net/http/httptest"
2525
"net/http/httputil"
@@ -151,7 +151,7 @@ func TestNewRequest_withUserData(t *testing.T) {
151151
}
152152

153153
// test body was JSON encoded
154-
body, _ := ioutil.ReadAll(req.Body)
154+
body, _ := io.ReadAll(req.Body)
155155
if string(body) != outBody {
156156
t.Errorf("NewRequest(%v)Body = %v, expected %v", inBody, string(body), outBody)
157157
}

opsmngr/organization_api_keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
atlas "go.mongodb.org/atlas/mongodbatlas"
2424
)
2525

26-
const apiKeysOrgPath = "api/public/v1.0/orgs/%s/apiKeys"
26+
const apiKeysOrgPath = "api/public/v1.0/orgs/%s/apiKeys" //nolint:gosec // This is a path
2727

2828
// APIKeysServiceOp handles communication with the APIKey related methods
2929
// of the MongoDB Ops Manager API.

opsmngr/organization_api_keys_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ func TestOrganizationAPIKeys_Create(t *testing.T) {
255255
client, mux, teardown := setup()
256256
defer teardown()
257257

258-
orgID := "1"
259-
260258
createRequest := &atlas.APIKeyInput{
261259
Desc: "test-apiKey",
262260
Roles: []string{"GROUP_OWNER"},
@@ -320,8 +318,6 @@ func TestOrganizationAPIKeys_Update(t *testing.T) {
320318
client, mux, teardown := setup()
321319
defer teardown()
322320

323-
orgID := "1"
324-
325321
updateRequest := &atlas.APIKeyInput{
326322
Desc: "test-apiKey",
327323
Roles: []string{"GROUP_OWNER"},
@@ -364,9 +360,6 @@ func TestOrganizationAPIKeys_Delete(t *testing.T) {
364360
client, mux, teardown := setup()
365361
defer teardown()
366362

367-
orgID := "1"
368-
apiKeyID := "5c47503320eef5699e1cce8d"
369-
370363
mux.HandleFunc(fmt.Sprintf("/api/public/v1.0/orgs/%s/apiKeys/%s", orgID, apiKeyID), func(w http.ResponseWriter, r *http.Request) {
371364
testMethod(t, r, http.MethodDelete)
372365
})

opsmngr/organization_whitelist_api_keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
atlas "go.mongodb.org/atlas/mongodbatlas"
2323
)
2424

25-
const organizationWhitelistAPIKeysPath = "api/public/v1.0/orgs/%s/apiKeys/%s/whitelist"
25+
const organizationWhitelistAPIKeysPath = "api/public/v1.0/orgs/%s/apiKeys/%s/whitelist" //nolint:gosec // This is a path
2626

2727
// WhitelistAPIKeysServiceOp handles communication with the Whitelist API keys related methods of the
2828
// MongoDB Ops Manager API.

opsmngr/organization_whitelist_api_keys_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ func TestOrganizationWhitelistAPIKeys_Create(t *testing.T) {
168168
client, mux, teardown := setup()
169169
defer teardown()
170170

171-
orgID := "ORG-ID"
172-
apiKeyID := "API-KEY-ID"
173-
174171
createRequest := []*atlas.WhitelistAPIKeysReq{
175172
{
176173
IPAddress: "77.54.32.11",

opsmngr/project_api_keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
atlas "go.mongodb.org/atlas/mongodbatlas"
2323
)
2424

25-
const projectAPIKeysPath = "api/public/v1.0/groups/%s/apiKeys"
25+
const projectAPIKeysPath = "api/public/v1.0/groups/%s/apiKeys" //nolint:gosec // This is a path
2626

2727
// ProjectAPIKeysOp handles communication with the APIKey related methods
2828
// of the MongoDB Ops Manager API.

0 commit comments

Comments
 (0)