Skip to content

Commit 7e79d10

Browse files
committed
updated per code review
Signed-off-by: Patrick Zheng <[email protected]>
1 parent 2c1f27d commit 7e79d10

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

verification/truststore/truststore.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
corex509 "github.com/notaryproject/notation-core-go/x509"
1515
"github.com/notaryproject/notation-go/dir"
16+
"github.com/notaryproject/notation-go/internal/slice"
1617
)
1718

1819
// Type is an enum for trust store types supported such as
@@ -64,6 +65,7 @@ func (trustStore *x509TrustStore) GetCertificates(ctx context.Context, storeType
6465
if os.IsNotExist(err) {
6566
return nil, fmt.Errorf("%q does not exist", path)
6667
}
68+
return nil, err
6769
}
6870

6971
// throw error if path is not a directory or is a symlink
@@ -130,12 +132,7 @@ func validateCerts(certs []*x509.Certificate, path string) error {
130132

131133
// isValidStoreType checks if storeType is supported
132134
func isValidStoreType(storeType Type) bool {
133-
for _, t := range Types {
134-
if storeType == t {
135-
return true
136-
}
137-
}
138-
return false
135+
return slice.Contains(Types, storeType)
139136
}
140137

141138
// isValidFileName checks if a file name is cross-platform compatible

0 commit comments

Comments
 (0)