Use %w, not %v, in fmt.Errorf, so errors can be unwrapped.

https://go.dev/blog/go1.13-errors#wrapping-errors-with-w
This commit is contained in:
David Fifield 2024-08-02 04:05:54 +00:00 committed by Cecylia Bocovich
parent 062411143c
commit bb2126b7c6
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
2 changed files with 2 additions and 2 deletions

View file

@ -79,7 +79,7 @@ func newBrokerChannelFromConfig(config ClientConfig) (*BrokerChannel, error) {
if config.UTLSClientID != "" {
utlsClientHelloID, err := utlsutil.NameToUTLSID(config.UTLSClientID)
if err != nil {
return nil, fmt.Errorf("unable to create broker channel: %v", err)
return nil, fmt.Errorf("unable to create broker channel: %w", err)
}
utlsConfig := &utls.Config{
RootCAs: certs.GetRootCAs(),