Skip to content

Commit 4a356a9

Browse files
committed
some small fixes
1 parent f4194cf commit 4a356a9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

apps/managedidentity/managedidentity.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func acquireAzureArc(ctx context.Context, client Client, resource string) (base.
296296
return base.AuthResult{}, fmt.Errorf("expected a 401 response, received %d", response.StatusCode)
297297
}
298298

299-
secret, err := client.getAzureArcSecretKey(response, resource, runtime.GOOS)
299+
secret, err := client.getAzureArcSecretKey(response, runtime.GOOS)
300300
if err != nil {
301301
return base.AuthResult{}, err
302302
}
@@ -446,9 +446,10 @@ func createAzureArcAuthRequest(ctx context.Context, resource string, key string)
446446
}
447447
req.Header.Set(metaHTTPHeaderName, "true")
448448

449-
if condition := key != ""; condition {
449+
if key != "" {
450450
req.Header.Set("Authorization", fmt.Sprintf("Basic %s", key))
451451
}
452+
452453
return req, nil
453454
}
454455

@@ -468,7 +469,7 @@ func isAzureArcEnvironment(identityEndpoint, imdsEndpoint string, platform strin
468469
return false
469470
}
470471

471-
func (c *Client) getAzureArcSecretKey(response *http.Response, resource string, platform string) (string, error) {
472+
func (c *Client) getAzureArcSecretKey(response *http.Response, platform string) (string, error) {
472473
wwwAuthenticateHeader := response.Header.Get(wwwAuthenticateHeaderName)
473474

474475
if len(wwwAuthenticateHeader) == 0 {

apps/managedidentity/managedidentity_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ func TestHandleAzureArcResponse(t *testing.T) {
811811
}
812812

813813
client := &Client{}
814-
_, err := client.getAzureArcSecretKey(response, "", tc.platform)
814+
_, err := client.getAzureArcSecretKey(response, tc.platform)
815815

816816
if err == nil || err.Error() != tc.expectedError {
817817
t.Fatalf("expected error: \"%v\"\ngot error: \"%v\"", tc.expectedError, err)

0 commit comments

Comments
 (0)