Changes requested by @codyoss

This commit is contained in:
Ryan Kohler
2022-04-22 10:45:22 -07:00
parent 8e4e7dc9f8
commit 6c2bc272c4
2 changed files with 3 additions and 11 deletions

View File

@@ -15,6 +15,8 @@ import (
"time"
)
var serviceAccountImpersonationCompiler = regexp.MustCompile("https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/(.*@.*):generateAccessToken")
const (
executableSupportedMaxVersion = 1
defaultTimeout = 30 * time.Second
@@ -57,7 +59,7 @@ func exitCodeError(exitCode int) error {
}
func executableError(err error) error {
return fmt.Errorf("oauth2/google: executable command failed: %v", err.Error())
return fmt.Errorf("oauth2/google: executable command failed: %v", err)
}
func executablesDisallowedError() error {
@@ -73,10 +75,6 @@ var runCommand = func(ctx context.Context, command string, env []string) ([]byte
cmd.Env = env
response, err := cmd.Output()
if ctx.Err() != nil {
return nil, ctx.Err()
}
if err == nil {
return response, nil
}
@@ -201,8 +199,6 @@ func (cs executableCredentialSource) getEnvironment() []string {
return result
}
var serviceAccountImpersonationCompiler = regexp.MustCompile("https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/(.*@.*):generateAccessToken")
func (cs executableCredentialSource) getNewEnvironmentVariables() map[string]string {
result := map[string]string{
"GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE": cs.config.Audience,

View File

@@ -28,10 +28,6 @@ func String(s string) *string {
return &s
}
var emptyEnv = func() []string {
return []string{}
}
func TestCreateExecutableCredential(t *testing.T) {
ec := ExecutableConfig{
Command: "blarg",