Pull request:* all: fix all staticcheck SA warnings
Merge in DNS/adguard-home from 2238-fix-static-analisys-warnings to master Squashed commit of the following: commit 721ca6fa1cbfdfe9d414e6ed52fec4a64653fb52 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Oct 30 15:48:10 2020 +0300 * all: fix all staticcheck SA warnings Closes #2238.
This commit is contained in:
@@ -306,8 +306,7 @@ func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string)
|
||||
log.Tracef("TLS: got certificate: %d bytes", len(certChain))
|
||||
|
||||
// now do a more extended validation
|
||||
var certs []*pem.Block // PEM-encoded certificates
|
||||
var skippedBytes []string // skipped bytes
|
||||
var certs []*pem.Block // PEM-encoded certificates
|
||||
|
||||
pemblock := []byte(certChain)
|
||||
for {
|
||||
@@ -318,10 +317,6 @@ func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string)
|
||||
}
|
||||
if decoded.Type == "CERTIFICATE" {
|
||||
certs = append(certs, decoded)
|
||||
} else {
|
||||
// ignore "this result of append is never used" warning
|
||||
// nolint
|
||||
skippedBytes = append(skippedBytes, decoded.Type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,8 +382,7 @@ func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string)
|
||||
|
||||
func validatePkey(data *tlsConfigStatus, pkey string) error {
|
||||
// now do a more extended validation
|
||||
var key *pem.Block // PEM-encoded certificates
|
||||
var skippedBytes []string // skipped bytes
|
||||
var key *pem.Block // PEM-encoded certificates
|
||||
|
||||
// go through all pem blocks, but take first valid pem block and drop the rest
|
||||
pemblock := []byte(pkey)
|
||||
@@ -401,10 +395,6 @@ func validatePkey(data *tlsConfigStatus, pkey string) error {
|
||||
if decoded.Type == "PRIVATE KEY" || strings.HasSuffix(decoded.Type, " PRIVATE KEY") {
|
||||
key = decoded
|
||||
break
|
||||
} else {
|
||||
// ignore "this result of append is never used"
|
||||
// nolint
|
||||
skippedBytes = append(skippedBytes, decoded.Type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user