mirror of
https://github.com/coredns/coredns.git
synced 2026-05-26 03:40:23 -04:00
lint(errorlint): handle wrapped errors
Enable errorlint and preserve wrapped error chains so runtime checks and tests classify failures correctly. This also makes Route53 surface insert failures instead of silently dropping them. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -97,7 +97,7 @@ func NewTLSConfigFromArgs(args ...string) (*tls.Config, error) {
|
||||
func NewTLSConfig(certPath, keyPath, caPath string) (*tls.Config, error) {
|
||||
cert, err := tls.LoadX509KeyPair(certPath, keyPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not load TLS cert: %s", err)
|
||||
return nil, fmt.Errorf("could not load TLS cert: %w", err)
|
||||
}
|
||||
|
||||
roots, err := loadRoots(caPath)
|
||||
@@ -140,11 +140,11 @@ func loadRoots(caPath string) (*x509.CertPool, error) {
|
||||
roots := x509.NewCertPool()
|
||||
pem, err := os.ReadFile(filepath.Clean(caPath))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading %s: %s", caPath, err)
|
||||
return nil, fmt.Errorf("error reading %s: %w", caPath, err)
|
||||
}
|
||||
ok := roots.AppendCertsFromPEM(pem)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("could not read root certs: %s", err)
|
||||
return nil, fmt.Errorf("could not read root certs from %s", caPath)
|
||||
}
|
||||
return roots, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user