Skip to content

Commit df01e32

Browse files
committed
fix usestdlibvars linter
Signed-off-by: Tim Ramlot <[email protected]>
1 parent f4bd9d2 commit df01e32

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ linters:
1818
- noctx
1919
- predeclared
2020
- unparam
21-
- usestdlibvars
2221
text: .*
2322
paths: [third_party$, builtin$, examples$]
2423
warn-unused: true

pkg/client/client_oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (c *OAuthClient) renewAccessToken(ctx context.Context) error {
186186
payload.Set("audience", audience)
187187
payload.Set("username", c.credentials.UserID)
188188
payload.Set("password", c.credentials.UserSecret)
189-
req, err := http.NewRequestWithContext(ctx, "POST", tokenURL, strings.NewReader(payload.Encode()))
189+
req, err := http.NewRequestWithContext(ctx, http.MethodPost, tokenURL, strings.NewReader(payload.Encode()))
190190
if err != nil {
191191
return errors.WithStack(err)
192192
}

pkg/internal/cyberark/identity/identity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func (c *Client) doStartAuthentication(ctx context.Context, username string) (ad
299299

300300
defer httpResponse.Body.Close()
301301

302-
if httpResponse.StatusCode != 200 {
302+
if httpResponse.StatusCode != http.StatusOK {
303303
err := fmt.Errorf("got unexpected status code %s from request to start authentication in CyberArk Identity API", httpResponse.Status)
304304
if httpResponse.StatusCode >= 500 || httpResponse.StatusCode < 400 {
305305
return response, err
@@ -410,7 +410,7 @@ func (c *Client) doAdvanceAuthentication(ctx context.Context, username string, p
410410

411411
// Important: Even login failures can produce a 200 status code, so this
412412
// check won't catch all failures
413-
if httpResponse.StatusCode != 200 {
413+
if httpResponse.StatusCode != http.StatusOK {
414414
err := fmt.Errorf("got unexpected status code %s from request to advance authentication in CyberArk Identity API", httpResponse.Status)
415415
if httpResponse.StatusCode >= 500 || httpResponse.StatusCode < 400 {
416416
return err

pkg/internal/cyberark/servicediscovery/discovery.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ func (c *Client) DiscoverIdentityAPIURL(ctx context.Context, subdomain string) (
9797

9898
defer resp.Body.Close()
9999

100-
if resp.StatusCode != 200 {
100+
if resp.StatusCode != http.StatusOK {
101101
// a 404 error is returned with an empty JSON body "{}" if the subdomain is unknown; at the time of writing, we haven't observed
102102
// any other errors and so we can't special case them
103-
if resp.StatusCode == 404 {
103+
if resp.StatusCode == http.StatusNotFound {
104104
return "", fmt.Errorf("got an HTTP 404 response from service discovery; maybe the subdomain %q is incorrect or does not exist?", subdomain)
105105
}
106106

0 commit comments

Comments
 (0)