From 7ed8899a94e9a74c77aab09fd0f65f4ffd35b51c Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 19 Sep 2024 12:29:28 +0000 Subject: [PATCH] fix: resolve comments Signed-off-by: Junjie Gao --- revocation/crl/errors.go | 2 +- revocation/crl/fetcher.go | 6 +++--- revocation/internal/crl/crl.go | 2 +- revocation/internal/crl/crl_test.go | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/revocation/crl/errors.go b/revocation/crl/errors.go index 2fdae9f5..a1978910 100644 --- a/revocation/crl/errors.go +++ b/revocation/crl/errors.go @@ -15,5 +15,5 @@ package crl import "errors" -// ErrCacheMiss is an error type for when a cache miss occurs +// ErrCacheMiss is returned when a cache miss occurs. var ErrCacheMiss = errors.New("cache miss") diff --git a/revocation/crl/fetcher.go b/revocation/crl/fetcher.go index a910dcff..ff583f3c 100644 --- a/revocation/crl/fetcher.go +++ b/revocation/crl/fetcher.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package crl provides Fetcher and Cache interface and implementations for -// fetching CRLs. +// Package crl provides Fetcher interface with its implementation, and the +// Cache interface. package crl import ( @@ -100,7 +100,7 @@ func (f *HTTPFetcher) Fetch(ctx context.Context, url string) (*Bundle, error) { return bundle, nil } -// fetch downloads the CRL from the given URL and saves it to the cache +// fetch downloads the CRL from the given URL. func (f *HTTPFetcher) fetch(ctx context.Context, url string) (*Bundle, error) { // fetch base CRL base, err := fetchCRL(ctx, url, f.httpClient) diff --git a/revocation/internal/crl/crl.go b/revocation/internal/crl/crl.go index f2df2c32..50f2c085 100644 --- a/revocation/internal/crl/crl.go +++ b/revocation/internal/crl/crl.go @@ -78,7 +78,7 @@ func CertCheckStatus(ctx context.Context, cert, issuer *x509.Certificate, opts C Result: result.ResultUnknown, ServerResults: []*result.ServerResult{{ RevocationMethod: result.RevocationMethodCRL, - Error: errors.New("CRL fetcher is nil"), + Error: errors.New("CRL fetcher cannot be nil"), Result: result.ResultUnknown, }}, RevocationMethod: result.RevocationMethodCRL, diff --git a/revocation/internal/crl/crl_test.go b/revocation/internal/crl/crl_test.go index 55fb4010..6f4f47e2 100644 --- a/revocation/internal/crl/crl_test.go +++ b/revocation/internal/crl/crl_test.go @@ -48,8 +48,8 @@ func TestCertCheckStatus(t *testing.T) { CRLDistributionPoints: []string{"http://example.com"}, } r := CertCheckStatus(context.Background(), cert, &x509.Certificate{}, CertCheckStatusOptions{}) - if r.ServerResults[0].Error.Error() != "CRL fetcher is nil" { - t.Fatalf("expected CRL fetcher is nil, got %v", r.ServerResults[0].Error) + if r.ServerResults[0].Error.Error() != "CRL fetcher cannot be nil" { + t.Fatalf("expected CRL fetcher cannot be nil, got %v", r.ServerResults[0].Error) } })