Skip to content

Commit

Permalink
lint fixing
Browse files Browse the repository at this point in the history
Signed-off-by: reggie-k <[email protected]>
  • Loading branch information
reggie-k committed Feb 3, 2025
1 parent a763a07 commit bda8298
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions util/git/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,10 +971,8 @@ func (m *nativeGitClient) runCredentialedCmd(args ...string) error {
for _, e := range environ {
if strings.HasPrefix(e, forceBasicAuthHeaderEnv+"=") {
args = append([]string{"--config-env", "http.extraHeader=" + forceBasicAuthHeaderEnv}, args...)
} else {
if strings.HasPrefix(e, bearerAuthHeaderEnv+"=") {
args = append([]string{"--config-env", "http.extraHeader=" + bearerAuthHeaderEnv}, args...)
}
} else if strings.HasPrefix(e, bearerAuthHeaderEnv+"=") {
args = append([]string{"--config-env", "http.extraHeader=" + bearerAuthHeaderEnv}, args...)
}
}

Expand Down
2 changes: 1 addition & 1 deletion util/git/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,6 @@ func (m *mockCreds) Environ() (io.Closer, []string, error) {
return io.NopCloser(nil), m.environ, nil
}

func (m *mockCreds) GetUserInfo(ctx context.Context) (string, string, error) {
func (m *mockCreds) GetUserInfo(_ context.Context) (string, string, error) {
return "", "", nil
}
6 changes: 2 additions & 4 deletions util/git/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,9 @@ func (creds HTTPSCreds) Environ() (io.Closer, []string, error) {
// skipped. This is insecure, but some environments may need it.
if creds.password != "" && creds.forceBasicAuth {
env = append(env, fmt.Sprintf("%s=%s", forceBasicAuthHeaderEnv, creds.BasicAuthHeader()))
} else {
} else if creds.bearerToken != "" {
// If bearer token is set, we will set ARGOCD_BEARER_AUTH_HEADER to hold the HTTP authorization header
if creds.bearerToken != "" {
env = append(env, fmt.Sprintf("%s=%s", bearerAuthHeaderEnv, creds.BearerAuthHeader()))
}
env = append(env, fmt.Sprintf("%s=%s", bearerAuthHeaderEnv, creds.BearerAuthHeader()))
}
nonce := creds.store.Add(text.FirstNonEmpty(creds.username, githubAccessTokenUsername), creds.password)
env = append(env, creds.store.Environ(nonce)...)
Expand Down

0 comments on commit bda8298

Please sign in to comment.