diff options
author | Pantelis Sampaziotis <psampaz@gmail.com> | 2020-10-14 19:42:13 +0000 |
---|---|---|
committer | Filippo Valsorda <filippo@golang.org> | 2020-11-06 23:59:04 +0000 |
commit | f7ef5ca54a103ed67425e1efe6d39d3bc8067bad (patch) | |
tree | 7e67b02d224fd2c24f67510f82917294c4a5a3bd /src/crypto | |
parent | 3a81338622eb5c8b94f11001855e2a68a9e36bed (diff) | |
download | go-git-f7ef5ca54a103ed67425e1efe6d39d3bc8067bad.tar.gz |
crypto/x509: add Unwrap to SystemRootsError
This change modifies Go to add the Unwrap method to SystemRootsError
Updates #30322
Change-Id: Ibe63d1d0bc832fc0607f09053908d55275a6f350
GitHub-Last-Rev: 9a95bc66019d25f02a0a5f92a87e9405a52802e4
GitHub-Pull-Request: golang/go#41981
Reviewed-on: https://go-review.googlesource.com/c/go/+/262343
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/x509/verify.go | 2 | ||||
-rw-r--r-- | src/crypto/x509/verify_test.go | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/crypto/x509/verify.go b/src/crypto/x509/verify.go index cb8d8f872d..5fdd4cb9fe 100644 --- a/src/crypto/x509/verify.go +++ b/src/crypto/x509/verify.go @@ -187,6 +187,8 @@ func (se SystemRootsError) Error() string { return msg } +func (se SystemRootsError) Unwrap() error { return se.Err } + // errNotParsed is returned when a certificate without ASN.1 contents is // verified. Platform-specific verification needs the ASN.1 contents. var errNotParsed = errors.New("x509: missing ASN.1 contents; use ParseCertificate") diff --git a/src/crypto/x509/verify_test.go b/src/crypto/x509/verify_test.go index c7a715bbcb..9cc17c7b3d 100644 --- a/src/crypto/x509/verify_test.go +++ b/src/crypto/x509/verify_test.go @@ -2005,3 +2005,11 @@ func TestSystemRootsError(t *testing.T) { t.Errorf("error was not SystemRootsError: %v", err) } } + +func TestSystemRootsErrorUnwrap(t *testing.T) { + var err1 = errors.New("err1") + err := SystemRootsError{Err: err1} + if !errors.Is(err, err1) { + t.Error("errors.Is failed, wanted success") + } +} |