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

@ -147,7 +147,7 @@ func (handler *httpHandler) turbotunnelMode(conn net.Conn, addr net.Addr) error
var clientID turbotunnel.ClientID
_, err := io.ReadFull(conn, clientID[:])
if err != nil {
return fmt.Errorf("reading ClientID: %v", err)
return fmt.Errorf("reading ClientID: %w", err)
}
// Store a short-term mapping from the ClientID to the client IP