Sfoglia il codice sorgente

Fix and/or silence linter issues

Herman Slatman 2 anni fa
parent
commit
bd4947121d

+ 9 - 9
test/integration/scep/common_test.go

@@ -335,12 +335,12 @@ func (c *client) requestCertificate(t *testing.T, commonName string, sans []stri
 }
 
 var (
-	oidExtensionAuthorityKeyId = asn1.ObjectIdentifier{2, 5, 29, 35}
-	oidExtensionSubjectKeyId   = asn1.ObjectIdentifier{2, 5, 29, 14}
+	oidExtensionAuthorityKeyID = asn1.ObjectIdentifier{2, 5, 29, 35}
+	oidExtensionSubjectKeyID   = asn1.ObjectIdentifier{2, 5, 29, 14}
 )
 
-type authorityKeyId struct {
-	Id []byte `asn1:"optional,tag:0"`
+type authorityKeyID struct {
+	ID []byte `asn1:"optional,tag:0"`
 }
 
 type pkcs1PublicKey struct {
@@ -367,12 +367,12 @@ func (c *client) requestCertificateEmulatingWindowsClient(t *testing.T, commonNa
 
 	// on Windows the self-signed certificate contains an authority key identifier
 	// extension that is marked critical
-	value, err := asn1.Marshal(authorityKeyId{[]byte("bla")}) // fake value
+	value, err := asn1.Marshal(authorityKeyID{[]byte("bla")}) // fake value
 	if err != nil {
 		return nil, fmt.Errorf("failed marshaling authority key ID")
 	}
 	authorityKeyIDExtension := pkix.Extension{
-		Id:       oidExtensionAuthorityKeyId,
+		Id:       oidExtensionAuthorityKeyID,
 		Critical: true,
 		Value:    value,
 	}
@@ -387,15 +387,15 @@ func (c *client) requestCertificateEmulatingWindowsClient(t *testing.T, commonNa
 	}
 
 	h := sha1.Sum(publicKeyBytes)
-	subjectKeyId := h[:]
+	subjectKeyID := h[:]
 
 	// create subject key ID extension
-	value, err = asn1.Marshal(subjectKeyId)
+	value, err = asn1.Marshal(subjectKeyID)
 	if err != nil {
 		return nil, fmt.Errorf("failed marshaling subject key ID: %w", err)
 	}
 	subjectKeyIDExtension := pkix.Extension{
-		Id:    oidExtensionSubjectKeyId,
+		Id:    oidExtensionSubjectKeyID,
 		Value: value,
 	}
 

+ 1 - 2
test/integration/scep/internal/x509/doc.go

@@ -4,7 +4,7 @@ It is based on Go 1.23, and has just the parts copied over required for
 parsing X509 certificates.
 
 The copy in this repository is intended to be used for preparing a SCEP request
-emulating a Windows SCEP client. The Windows SCEP client markes the authority
+emulating a Windows SCEP client. The Windows SCEP client marks the authority
 key identifier as critical in the self-signed SCEP enrolment certificate, which
 fails to parse using the standard X509 parser in Go 1.23 and later.
 
@@ -12,5 +12,4 @@ This is itself a copy from the copy in our PKCS7 package. We currently don't
 intend to maintain that in an importable package, since we only need these copies
 for testing purposes, hence needing another copy of the code.
 */
-
 package legacyx509

+ 1 - 0
test/integration/scep/internal/x509/oid.go

@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//nolint:stylecheck,revive,gocritic // code copied from crypto/x509
 package legacyx509
 
 import (

+ 1 - 0
test/integration/scep/internal/x509/parser.go

@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//nolint:revive,gocritic,errorlint,unconvert // code copied from crypto/x509
 package legacyx509
 
 import (

+ 5 - 0
test/integration/scep/internal/x509/verify.go

@@ -1,3 +1,8 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//nolint:gocritic // code copied from crypto/x509
 package legacyx509
 
 import (

+ 2 - 0
test/integration/scep/internal/x509/x509.go

@@ -18,6 +18,8 @@
 // On macOS and Windows, certificate verification is handled by system APIs, but
 // the package aims to apply consistent validation rules across operating
 // systems.
+
+//nolint:gosec,unused // code copied from crypto/x509
 package legacyx509
 
 import (