Skip to content

Commit

Permalink
fmt.Errorf instead of errors.New
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Sep 29, 2021
1 parent c70ac19 commit c9cbc7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions chain/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package chain

import (
"context"
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -68,7 +67,7 @@ func BridgeWithConfig(ctx context.Context, chain config.Chain, d bool) error {
}
l, ok := d.(bridge.ListenConfig)
if !ok || l == nil {
return errors.New("the last proxy could not listen")
return fmt.Errorf("the last proxy could not listen")
}
listenConfig = l
}
Expand Down
3 changes: 1 addition & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"encoding/json"
"errors"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -105,7 +104,7 @@ func (m Node) MarshalJSON() ([]byte, error) {

func (m *Node) UnmarshalJSON(data []byte) error {
if m == nil {
return errors.New("node: UnmarshalJSON on nil pointer")
return fmt.Errorf("node: UnmarshalJSON on nil pointer")
}
if len(data) > 0 {
switch data[0] {
Expand Down
4 changes: 2 additions & 2 deletions internal/warp/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package warp

import (
"context"
"errors"
"fmt"
"net"
"sync"
"sync/atomic"
Expand All @@ -12,7 +12,7 @@ import (
)

var (
ErrConnClosed = errors.New("use of closed network connection")
ErrConnClosed = fmt.Errorf("use of closed network connection")
)

func ConnWithCloser(conn net.Conn, closer func() error) net.Conn {
Expand Down

0 comments on commit c9cbc7b

Please sign in to comment.