Skip to content

Commit 8b256f0

Browse files
committed
address linter warning for go 1.19
1 parent 5735d1d commit 8b256f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+230
-264
lines changed

acme/api/account_test.go

+10-17
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,24 @@ var (
3434

3535
type fakeProvisioner struct{}
3636

37-
func (*fakeProvisioner) AuthorizeOrderIdentifier(ctx context.Context, identifier provisioner.ACMEIdentifier) error {
37+
func (*fakeProvisioner) AuthorizeOrderIdentifier(context.Context, provisioner.ACMEIdentifier) error {
3838
return nil
3939
}
40-
41-
func (*fakeProvisioner) AuthorizeSign(ctx context.Context, token string) ([]provisioner.SignOption, error) {
40+
func (*fakeProvisioner) AuthorizeSign(context.Context, string) ([]provisioner.SignOption, error) {
4241
return nil, nil
4342
}
44-
45-
func (*fakeProvisioner) IsChallengeEnabled(ctx context.Context, challenge provisioner.ACMEChallenge) bool {
43+
func (*fakeProvisioner) IsChallengeEnabled(context.Context, provisioner.ACMEChallenge) bool {
4644
return true
4745
}
48-
49-
func (*fakeProvisioner) IsAttestationFormatEnabled(ctx context.Context, format provisioner.ACMEAttestationFormat) bool {
46+
func (*fakeProvisioner) IsAttestationFormatEnabled(context.Context, provisioner.ACMEAttestationFormat) bool {
5047
return true
5148
}
52-
53-
func (*fakeProvisioner) GetAttestationRoots() (*x509.CertPool, bool) {
54-
return nil, false
55-
}
56-
57-
func (*fakeProvisioner) AuthorizeRevoke(ctx context.Context, token string) error { return nil }
58-
func (*fakeProvisioner) GetID() string { return "" }
59-
func (*fakeProvisioner) GetName() string { return "" }
60-
func (*fakeProvisioner) DefaultTLSCertDuration() time.Duration { return 0 }
61-
func (*fakeProvisioner) GetOptions() *provisioner.Options { return nil }
49+
func (*fakeProvisioner) GetAttestationRoots() (*x509.CertPool, bool) { return nil, false }
50+
func (*fakeProvisioner) AuthorizeRevoke(context.Context, string) error { return nil }
51+
func (*fakeProvisioner) GetID() string { return "" }
52+
func (*fakeProvisioner) GetName() string { return "" }
53+
func (*fakeProvisioner) DefaultTLSCertDuration() time.Duration { return 0 }
54+
func (*fakeProvisioner) GetOptions() *provisioner.Options { return nil }
6255

6356
func newProv() acme.Provisioner {
6457
// Initialize provisioners

acme/api/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func shouldAddMetaObject(p *provisioner.ACME) bool {
273273

274274
// NotImplemented returns a 501 and is generally a placeholder for functionality which
275275
// MAY be added at some point in the future but is not in any way a guarantee of such.
276-
func NotImplemented(w http.ResponseWriter, r *http.Request) {
276+
func NotImplemented(w http.ResponseWriter, _ *http.Request) {
277277
render.Error(w, acme.NewError(acme.ErrorNotImplementedType, "this API is not implemented"))
278278
}
279279

acme/api/middleware_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
var testBody = []byte("foo")
2626

27-
func testNext(w http.ResponseWriter, r *http.Request) {
27+
func testNext(w http.ResponseWriter, _ *http.Request) {
2828
w.Write(testBody)
2929
}
3030

@@ -328,7 +328,7 @@ func TestHandler_isPostAsGet(t *testing.T) {
328328

329329
type errReader int
330330

331-
func (errReader) Read(p []byte) (n int, err error) {
331+
func (errReader) Read([]byte) (int, error) {
332332
return 0, errors.New("force")
333333
}
334334
func (errReader) Close() error {

acme/api/revoke.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func RevokeCert(w http.ResponseWriter, r *http.Request) {
151151
// the identifiers in the certificate are extracted and compared against the (valid) Authorizations
152152
// that are stored for the ACME Account. If these sets match, the Account is considered authorized
153153
// to revoke the certificate. If this check fails, the client will receive an unauthorized error.
154-
func isAccountAuthorized(ctx context.Context, dbCert *acme.Certificate, certToBeRevoked *x509.Certificate, account *acme.Account) *acme.Error {
154+
func isAccountAuthorized(_ context.Context, dbCert *acme.Certificate, certToBeRevoked *x509.Certificate, account *acme.Account) *acme.Error {
155155
if !account.IsValid() {
156156
return wrapUnauthorizedError(certToBeRevoked, nil, fmt.Sprintf("account '%s' has status '%s'", account.ID, account.Status), nil)
157157
}

acme/api/revoke_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func jwkEncode(pub crypto.PublicKey) (string, error) {
258258
// jwsFinal constructs the final JWS object.
259259
// Implementation taken from github.com/mholt/acmez, which seems to be based on
260260
// https://github.com/golang/crypto/blob/master/acme/jws.go.
261-
func jwsFinal(sha crypto.Hash, sig []byte, phead, payload string) ([]byte, error) {
261+
func jwsFinal(_ crypto.Hash, sig []byte, phead, payload string) ([]byte, error) {
262262
enc := struct {
263263
Protected string `json:"protected"`
264264
Payload string `json:"payload"`
@@ -281,7 +281,7 @@ type mockCA struct {
281281
MockAreSANsallowed func(ctx context.Context, sans []string) error
282282
}
283283

284-
func (m *mockCA) Sign(cr *x509.CertificateRequest, opts provisioner.SignOptions, signOpts ...provisioner.SignOption) ([]*x509.Certificate, error) {
284+
func (m *mockCA) Sign(*x509.CertificateRequest, provisioner.SignOptions, ...provisioner.SignOption) ([]*x509.Certificate, error) {
285285
return nil, nil
286286
}
287287

acme/challenge.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ const (
520520
coseAlgRS256 coseAlgorithmIdentifier = -257
521521
)
522522

523-
func doTPMAttestationFormat(ctx context.Context, prov Provisioner, ch *Challenge, jwk *jose.JSONWebKey, att *attestationObject) (*tpmAttestationData, error) {
523+
func doTPMAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge, jwk *jose.JSONWebKey, att *attestationObject) (*tpmAttestationData, error) {
524524
ver, ok := att.AttStatement["ver"].(string)
525525
if !ok {
526526
return nil, NewError(ErrorBadAttestationStatementType, "ver not present")
@@ -742,11 +742,7 @@ func validateAKCertificate(c *x509.Certificate) error {
742742
if err := validateAKCertificateExtendedKeyUsage(c); err != nil {
743743
return err
744744
}
745-
if err := validateAKCertificateSubjectAlternativeNames(c); err != nil {
746-
return err
747-
}
748-
749-
return nil
745+
return validateAKCertificateSubjectAlternativeNames(c)
750746
}
751747

752748
// validateAKCertificateSubjectAlternativeNames checks if the AK certificate
@@ -828,7 +824,7 @@ type appleAttestationData struct {
828824
Fingerprint string
829825
}
830826

831-
func doAppleAttestationFormat(ctx context.Context, prov Provisioner, ch *Challenge, att *attestationObject) (*appleAttestationData, error) {
827+
func doAppleAttestationFormat(_ context.Context, prov Provisioner, _ *Challenge, att *attestationObject) (*appleAttestationData, error) {
832828
// Use configured or default attestation roots if none is configured.
833829
roots, ok := prov.GetAttestationRoots()
834830
if !ok {
@@ -933,7 +929,7 @@ type stepAttestationData struct {
933929
Fingerprint string
934930
}
935931

936-
func doStepAttestationFormat(ctx context.Context, prov Provisioner, ch *Challenge, jwk *jose.JSONWebKey, att *attestationObject) (*stepAttestationData, error) {
932+
func doStepAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge, jwk *jose.JSONWebKey, att *attestationObject) (*stepAttestationData, error) {
937933
// Use configured or default attestation roots if none is configured.
938934
roots, ok := prov.GetAttestationRoots()
939935
if !ok {

acme/challenge_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func mustAttestApple(t *testing.T, nonce string) ([]byte, *x509.Certificate, *x5
148148
return payload, leaf, ca.Root
149149
}
150150

151-
func mustAttestYubikey(t *testing.T, nonce, keyAuthorization string, serial int) ([]byte, *x509.Certificate, *x509.Certificate) {
151+
func mustAttestYubikey(t *testing.T, _, keyAuthorization string, serial int) ([]byte, *x509.Certificate, *x509.Certificate) {
152152
ca, err := minica.New()
153153
fatalError(t, err)
154154

@@ -888,7 +888,7 @@ func TestChallenge_Validate(t *testing.T) {
888888

889889
type errReader int
890890

891-
func (errReader) Read(p []byte) (n int, err error) {
891+
func (errReader) Read([]byte) (int, error) {
892892
return 0, errors.New("force")
893893
}
894894
func (errReader) Close() error {
@@ -1631,14 +1631,14 @@ func newTestTLSALPNServer(validationCert *tls.Certificate, opts ...func(*httptes
16311631
// noopConn is a mock net.Conn that does nothing.
16321632
type noopConn struct{}
16331633

1634-
func (c *noopConn) Read(_ []byte) (n int, err error) { return 0, io.EOF }
1635-
func (c *noopConn) Write(_ []byte) (n int, err error) { return 0, io.EOF }
1636-
func (c *noopConn) Close() error { return nil }
1637-
func (c *noopConn) LocalAddr() net.Addr { return &net.IPAddr{IP: net.IPv4zero, Zone: ""} }
1638-
func (c *noopConn) RemoteAddr() net.Addr { return &net.IPAddr{IP: net.IPv4zero, Zone: ""} }
1639-
func (c *noopConn) SetDeadline(t time.Time) error { return nil }
1640-
func (c *noopConn) SetReadDeadline(t time.Time) error { return nil }
1641-
func (c *noopConn) SetWriteDeadline(t time.Time) error { return nil }
1634+
func (c *noopConn) Read(_ []byte) (n int, err error) { return 0, io.EOF }
1635+
func (c *noopConn) Write(_ []byte) (n int, err error) { return 0, io.EOF }
1636+
func (c *noopConn) Close() error { return nil }
1637+
func (c *noopConn) LocalAddr() net.Addr { return &net.IPAddr{IP: net.IPv4zero, Zone: ""} }
1638+
func (c *noopConn) RemoteAddr() net.Addr { return &net.IPAddr{IP: net.IPv4zero, Zone: ""} }
1639+
func (c *noopConn) SetDeadline(time.Time) error { return nil }
1640+
func (c *noopConn) SetReadDeadline(time.Time) error { return nil }
1641+
func (c *noopConn) SetWriteDeadline(time.Time) error { return nil }
16421642

16431643
func newTLSALPNValidationCert(keyAuthHash []byte, obsoleteOID, critical bool, names ...string) (*tls.Certificate, error) {
16441644
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)

acme/common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type PrerequisitesChecker func(ctx context.Context) (bool, error)
4646

4747
// DefaultPrerequisitesChecker is the default PrerequisiteChecker and returns
4848
// always true.
49-
func DefaultPrerequisitesChecker(ctx context.Context) (bool, error) {
49+
func DefaultPrerequisitesChecker(context.Context) (bool, error) {
5050
return true, nil
5151
}
5252

acme/db/nosql/account.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (dba *dbAccount) clone() *dbAccount {
2626
return &nu
2727
}
2828

29-
func (db *DB) getAccountIDByKeyID(ctx context.Context, kid string) (string, error) {
29+
func (db *DB) getAccountIDByKeyID(_ context.Context, kid string) (string, error) {
3030
id, err := db.db.Get(accountByKeyIDTable, []byte(kid))
3131
if err != nil {
3232
if nosqlDB.IsErrNotFound(err) {
@@ -38,7 +38,7 @@ func (db *DB) getAccountIDByKeyID(ctx context.Context, kid string) (string, erro
3838
}
3939

4040
// getDBAccount retrieves and unmarshals dbAccount.
41-
func (db *DB) getDBAccount(ctx context.Context, id string) (*dbAccount, error) {
41+
func (db *DB) getDBAccount(_ context.Context, id string) (*dbAccount, error) {
4242
data, err := db.db.Get(accountTable, []byte(id))
4343
if err != nil {
4444
if nosqlDB.IsErrNotFound(err) {

acme/db/nosql/authz.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (ba *dbAuthz) clone() *dbAuthz {
3232

3333
// getDBAuthz retrieves and unmarshals a database representation of the
3434
// ACME Authorization type.
35-
func (db *DB) getDBAuthz(ctx context.Context, id string) (*dbAuthz, error) {
35+
func (db *DB) getDBAuthz(_ context.Context, id string) (*dbAuthz, error) {
3636
data, err := db.db.Get(authzTable, []byte(id))
3737
if nosql.IsErrNotFound(err) {
3838
return nil, acme.NewError(acme.ErrorMalformedType, "authz %s not found", id)
@@ -121,7 +121,7 @@ func (db *DB) UpdateAuthorization(ctx context.Context, az *acme.Authorization) e
121121
}
122122

123123
// GetAuthorizationsByAccountID retrieves and unmarshals ACME authz types from the database.
124-
func (db *DB) GetAuthorizationsByAccountID(ctx context.Context, accountID string) ([]*acme.Authorization, error) {
124+
func (db *DB) GetAuthorizationsByAccountID(_ context.Context, accountID string) ([]*acme.Authorization, error) {
125125
entries, err := db.db.List(authzTable)
126126
if err != nil {
127127
return nil, errors.Wrapf(err, "error listing authz")

acme/db/nosql/certificate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (db *DB) CreateCertificate(ctx context.Context, cert *acme.Certificate) err
6969

7070
// GetCertificate retrieves and unmarshals an ACME certificate type from the
7171
// datastore.
72-
func (db *DB) GetCertificate(ctx context.Context, id string) (*acme.Certificate, error) {
72+
func (db *DB) GetCertificate(_ context.Context, id string) (*acme.Certificate, error) {
7373
b, err := db.db.Get(certTable, []byte(id))
7474
if nosql.IsErrNotFound(err) {
7575
return nil, acme.NewError(acme.ErrorMalformedType, "certificate %s not found", id)

acme/db/nosql/challenge.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (dbc *dbChallenge) clone() *dbChallenge {
2929
return &u
3030
}
3131

32-
func (db *DB) getDBChallenge(ctx context.Context, id string) (*dbChallenge, error) {
32+
func (db *DB) getDBChallenge(_ context.Context, id string) (*dbChallenge, error) {
3333
data, err := db.db.Get(challengeTable, []byte(id))
3434
if nosql.IsErrNotFound(err) {
3535
return nil, acme.NewError(acme.ErrorMalformedType, "challenge %s not found", id)
@@ -69,6 +69,7 @@ func (db *DB) CreateChallenge(ctx context.Context, ch *acme.Challenge) error {
6969
// GetChallenge retrieves and unmarshals an ACME challenge type from the database.
7070
// Implements the acme.DB GetChallenge interface.
7171
func (db *DB) GetChallenge(ctx context.Context, id, authzID string) (*acme.Challenge, error) {
72+
_ = authzID // unused input
7273
dbch, err := db.getDBChallenge(ctx, id)
7374
if err != nil {
7475
return nil, err

acme/db/nosql/eab.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type dbExternalAccountKeyReference struct {
3535
}
3636

3737
// getDBExternalAccountKey retrieves and unmarshals dbExternalAccountKey.
38-
func (db *DB) getDBExternalAccountKey(ctx context.Context, id string) (*dbExternalAccountKey, error) {
38+
func (db *DB) getDBExternalAccountKey(_ context.Context, id string) (*dbExternalAccountKey, error) {
3939
data, err := db.db.Get(externalAccountKeyTable, []byte(id))
4040
if err != nil {
4141
if nosqlDB.IsErrNotFound(err) {
@@ -160,6 +160,8 @@ func (db *DB) DeleteExternalAccountKey(ctx context.Context, provisionerID, keyID
160160

161161
// GetExternalAccountKeys retrieves all External Account Binding keys for a provisioner
162162
func (db *DB) GetExternalAccountKeys(ctx context.Context, provisionerID, cursor string, limit int) ([]*acme.ExternalAccountKey, string, error) {
163+
_, _ = cursor, limit // unused input
164+
163165
externalAccountKeyMutex.RLock()
164166
defer externalAccountKeyMutex.RUnlock()
165167

@@ -227,7 +229,7 @@ func (db *DB) GetExternalAccountKeyByReference(ctx context.Context, provisionerI
227229
return db.GetExternalAccountKey(ctx, provisionerID, dbExternalAccountKeyReference.ExternalAccountKeyID)
228230
}
229231

230-
func (db *DB) GetExternalAccountKeyByAccountID(ctx context.Context, provisionerID, accountID string) (*acme.ExternalAccountKey, error) {
232+
func (db *DB) GetExternalAccountKeyByAccountID(context.Context, string, string) (*acme.ExternalAccountKey, error) {
231233
//nolint:nilnil // legacy
232234
return nil, nil
233235
}

acme/db/nosql/nonce.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (db *DB) CreateNonce(ctx context.Context) (acme.Nonce, error) {
3939

4040
// DeleteNonce verifies that the nonce is valid (by checking if it exists),
4141
// and if so, consumes the nonce resource by deleting it from the database.
42-
func (db *DB) DeleteNonce(ctx context.Context, nonce acme.Nonce) error {
42+
func (db *DB) DeleteNonce(_ context.Context, nonce acme.Nonce) error {
4343
err := db.db.Update(&database.Tx{
4444
Operations: []*database.TxEntry{
4545
{

acme/db/nosql/nosql.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func New(db nosqlDB.DB) (*DB, error) {
4848

4949
// save writes the new data to the database, overwriting the old data if it
5050
// existed.
51-
func (db *DB) save(ctx context.Context, id string, nu, old interface{}, typ string, table []byte) error {
51+
func (db *DB) save(_ context.Context, id string, nu, old interface{}, typ string, table []byte) error {
5252
var (
5353
err error
5454
newB []byte

acme/db/nosql/order.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (a *dbOrder) clone() *dbOrder {
3535
}
3636

3737
// getDBOrder retrieves and unmarshals an ACME Order type from the database.
38-
func (db *DB) getDBOrder(ctx context.Context, id string) (*dbOrder, error) {
38+
func (db *DB) getDBOrder(_ context.Context, id string) (*dbOrder, error) {
3939
b, err := db.db.Get(orderTable, []byte(id))
4040
if nosql.IsErrNotFound(err) {
4141
return nil, acme.NewError(acme.ErrorMalformedType, "order %s not found", id)

acme/order_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (m *mockSignAuth) LoadProvisionerByName(name string) (provisioner.Interface
301301
return m.ret1.(provisioner.Interface), m.err
302302
}
303303

304-
func (m *mockSignAuth) IsRevoked(sn string) (bool, error) {
304+
func (m *mockSignAuth) IsRevoked(string) (bool, error) {
305305
return false, nil
306306
}
307307

api/api.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (h *caHandler) Route(r Router) {
288288
// New creates a new RouterHandler with the CA endpoints.
289289
//
290290
// Deprecated: Use api.Route(r Router)
291-
func New(auth Authority) RouterHandler {
291+
func New(Authority) RouterHandler {
292292
return &caHandler{}
293293
}
294294

@@ -335,7 +335,7 @@ func Version(w http.ResponseWriter, r *http.Request) {
335335
}
336336

337337
// Health is an HTTP handler that returns the status of the server.
338-
func Health(w http.ResponseWriter, r *http.Request) {
338+
func Health(w http.ResponseWriter, _ *http.Request) {
339339
render.JSON(w, HealthResponse{Status: "ok"})
340340
}
341341

authority/admin/api/acme.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ func NewACMEAdminResponder() ACMEAdminResponder {
6969
}
7070

7171
// GetExternalAccountKeys writes the response for the EAB keys GET endpoint
72-
func (h *acmeAdminResponder) GetExternalAccountKeys(w http.ResponseWriter, r *http.Request) {
72+
func (h *acmeAdminResponder) GetExternalAccountKeys(w http.ResponseWriter, _ *http.Request) {
7373
render.Error(w, admin.NewError(admin.ErrorNotImplementedType, "this functionality is currently only available in Certificate Manager: https://u.step.sm/cm"))
7474
}
7575

7676
// CreateExternalAccountKey writes the response for the EAB key POST endpoint
77-
func (h *acmeAdminResponder) CreateExternalAccountKey(w http.ResponseWriter, r *http.Request) {
77+
func (h *acmeAdminResponder) CreateExternalAccountKey(w http.ResponseWriter, _ *http.Request) {
7878
render.Error(w, admin.NewError(admin.ErrorNotImplementedType, "this functionality is currently only available in Certificate Manager: https://u.step.sm/cm"))
7979
}
8080

8181
// DeleteExternalAccountKey writes the response for the EAB key DELETE endpoint
82-
func (h *acmeAdminResponder) DeleteExternalAccountKey(w http.ResponseWriter, r *http.Request) {
82+
func (h *acmeAdminResponder) DeleteExternalAccountKey(w http.ResponseWriter, _ *http.Request) {
8383
render.Error(w, admin.NewError(admin.ErrorNotImplementedType, "this functionality is currently only available in Certificate Manager: https://u.step.sm/cm"))
8484
}
8585

authority/admin/db/nosql/admin.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (dba *dbAdmin) clone() *dbAdmin {
4040
return &u
4141
}
4242

43-
func (db *DB) getDBAdminBytes(ctx context.Context, id string) ([]byte, error) {
43+
func (db *DB) getDBAdminBytes(_ context.Context, id string) ([]byte, error) {
4444
data, err := db.db.Get(adminsTable, []byte(id))
4545
if nosql.IsErrNotFound(err) {
4646
return nil, admin.NewError(admin.ErrorNotFoundType, "admin %s not found", id)
@@ -102,7 +102,7 @@ func (db *DB) GetAdmin(ctx context.Context, id string) (*linkedca.Admin, error)
102102
// GetAdmins retrieves and unmarshals all active (not deleted) admins
103103
// from the database.
104104
// TODO should we be paginating?
105-
func (db *DB) GetAdmins(ctx context.Context) ([]*linkedca.Admin, error) {
105+
func (db *DB) GetAdmins(context.Context) ([]*linkedca.Admin, error) {
106106
dbEntries, err := db.db.List(adminsTable)
107107
if err != nil {
108108
return nil, errors.Wrap(err, "error loading admins")
@@ -115,12 +115,10 @@ func (db *DB) GetAdmins(ctx context.Context) ([]*linkedca.Admin, error) {
115115
if errors.As(err, &ae) {
116116
if ae.IsType(admin.ErrorDeletedType) || ae.IsType(admin.ErrorAuthorityMismatchType) {
117117
continue
118-
} else {
119-
return nil, err
120118
}
121-
} else {
122119
return nil, err
123120
}
121+
return nil, err
124122
}
125123
if adm.AuthorityId != db.authorityID {
126124
continue

authority/admin/db/nosql/nosql.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func New(db nosqlDB.DB, authorityID string) (*DB, error) {
3636

3737
// save writes the new data to the database, overwriting the old data if it
3838
// existed.
39-
func (db *DB) save(ctx context.Context, id string, nu, old interface{}, typ string, table []byte) error {
39+
func (db *DB) save(_ context.Context, id string, nu, old interface{}, typ string, table []byte) error {
4040
var (
4141
err error
4242
newB []byte

authority/admin/db/nosql/policy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (dbap *dbAuthorityPolicy) convert() *linkedca.Policy {
7171
return dbToLinked(dbap.Policy)
7272
}
7373

74-
func (db *DB) getDBAuthorityPolicyBytes(ctx context.Context, authorityID string) ([]byte, error) {
74+
func (db *DB) getDBAuthorityPolicyBytes(_ context.Context, authorityID string) ([]byte, error) {
7575
data, err := db.db.Get(authorityPoliciesTable, []byte(authorityID))
7676
if nosql.IsErrNotFound(err) {
7777
return nil, admin.NewError(admin.ErrorNotFoundType, "authority policy not found")

0 commit comments

Comments
 (0)