all: Modernize error wrapping (#8491)

This replaces old style errors.Wrap with modern fmt.Errorf and removes
the (direct) dependency on github.com/pkg/errors. A couple of cases are
adjusted by hand as previously errors.Wrap(nil, ...) would return nil,
which is not what fmt.Errorf does.
This commit is contained in:
Jakob Borg
2022-08-16 10:01:49 +02:00
committed by GitHub
parent 75eeae0ee7
commit b10d106a55
23 changed files with 108 additions and 109 deletions
+2 -3
View File
@@ -5,13 +5,12 @@ package client
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
"net/url"
"time"
"github.com/pkg/errors"
"github.com/syncthing/syncthing/lib/dialer"
syncthingprotocol "github.com/syncthing/syncthing/lib/protocol"
"github.com/syncthing/syncthing/lib/relay/protocol"
@@ -213,7 +212,7 @@ func performHandshakeAndValidation(conn *tls.Conn, uri *url.URL) error {
if relayIDs != "" {
relayID, err := syncthingprotocol.DeviceIDFromString(relayIDs)
if err != nil {
return errors.Wrap(err, "relay address contains invalid verification id")
return fmt.Errorf("relay address contains invalid verification id: %w", err)
}
certs := cs.PeerCertificates