File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,14 +16,18 @@ const (
1616var (
1717 errMissingKey = fmt .Errorf ("missing %s" , accessKeyIDFile )
1818 errMissingSecret = fmt .Errorf ("missing %s" , accessSecretKeyFile )
19- emptyAuth = credentials . AnonymousCredentials
19+ emptyCreds = creds {}
2020)
2121
2222type creds struct {
2323 accessKeyID string
2424 accessKeySecret string
2525}
2626
27+ func (c * creds ) isZero () bool {
28+ return c .accessKeyID == "" && c .accessKeySecret == ""
29+ }
30+
2731// getAuth gets storage credentials from accessKeyIDFile and accessSecretKeyFile.
2832// if a key exists but not a secret, or vice-versa, returns an error.
2933// if both don't exist returns emptyAuth.
@@ -32,7 +36,7 @@ func getAuth(fs sys.FS) (*credentials.Credentials, error) {
3236 accessKeyIDBytes , accessKeyErr := fs .ReadFile (accessKeyIDFile )
3337 accessSecretKeyBytes , accessSecretKeyErr := fs .ReadFile (accessSecretKeyFile )
3438 if accessKeyErr == os .ErrNotExist && accessSecretKeyErr == os .ErrNotExist {
35- return emptyAuth , nil
39+ return & emptyCreds , nil
3640 }
3741 if accessKeyErr != nil && accessSecretKeyErr == nil {
3842 return nil , errMissingKey
You can’t perform that action at this time.
0 commit comments