From baeaab58654d58cb511098089a60e98340a39c59 Mon Sep 17 00:00:00 2001 From: Aaron Gable Date: Wed, 21 Aug 2024 10:07:19 -0700 Subject: [PATCH] Rename desc->description, prevent loopvar aliasing --- .golangci.yaml | 2 +- ca/ca.go | 7 ++++--- cmd/pebble/main.go | 2 +- go.mod | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 8f8d6d67..edb90a44 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -14,6 +14,7 @@ linters: - bidichk - bodyclose - containedctx + - copyloopvar - decorder - dogsled - dupword @@ -21,7 +22,6 @@ linters: - errcheck - errchkjson - errorlint - - exportloopref - forcetypeassert - ginkgolinter - gocheckcompilerdirectives diff --git a/ca/ca.go b/ca/ca.go index febe5160..949108a7 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -45,8 +45,8 @@ type chain struct { } type Profile struct { - Desc string - ValidityPeriod time.Duration + Description string + ValidityPeriod uint64 } func (c *chain) String() string { @@ -380,6 +380,7 @@ func New(log *log.Logger, db *db.MemoryStore, ocspResponderURL string, alternate prof.ValidityPeriod = defaultValidityPeriod } ca.profiles[name] = &prof + ca.log.Printf("Loaded profile %q with certificate validity period of %d seconds", name, prof.ValidityPeriod) } return ca @@ -525,7 +526,7 @@ func (ca *CAImpl) GetIntermediateKey(no int) *rsa.PrivateKey { func (ca *CAImpl) GetProfiles() map[string]string { res := make(map[string]string, len(ca.profiles)) for name, prof := range ca.profiles { - res[name] = prof.Desc + res[name] = prof.Description } return res } diff --git a/cmd/pebble/main.go b/cmd/pebble/main.go index 35671556..40e6e6f6 100644 --- a/cmd/pebble/main.go +++ b/cmd/pebble/main.go @@ -107,7 +107,7 @@ func main() { if len(profiles) == 0 { profiles = map[string]ca.Profile{ "default": { - Desc: "The default profile", + Description: "The default profile", ValidityPeriod: 0, // Will be overridden by the CA's default }, } diff --git a/go.mod b/go.mod index e0745451..251c2b75 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/letsencrypt/pebble/v2 -go 1.21 +go 1.22 require ( github.com/go-jose/go-jose/v4 v4.0.1