Skip to content

Commit 4dfc75d

Browse files
authored
beacon/types, cmd/devp2p, p2p/enr: clean up uses of fmt.Errorf (#30182)
1 parent 4ad88e9 commit 4dfc75d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

beacon/types/beacon_block.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func BlockFromJSON(forkName string, data []byte) (*BeaconBlock, error) {
4848
case "capella":
4949
obj = new(capella.BeaconBlock)
5050
default:
51-
return nil, fmt.Errorf("unsupported fork: " + forkName)
51+
return nil, fmt.Errorf("unsupported fork: %s", forkName)
5252
}
5353
if err := json.Unmarshal(data, obj); err != nil {
5454
return nil, err

beacon/types/exec_header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func ExecutionHeaderFromJSON(forkName string, data []byte) (*ExecutionHeader, er
4646
case "deneb":
4747
obj = new(deneb.ExecutionPayloadHeader)
4848
default:
49-
return nil, fmt.Errorf("unsupported fork: " + forkName)
49+
return nil, fmt.Errorf("unsupported fork: %s", forkName)
5050
}
5151
if err := json.Unmarshal(data, obj); err != nil {
5252
return nil, err

cmd/devp2p/rlpxcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func rlpxPing(ctx *cli.Context) error {
7979
n := getNodeArg(ctx)
8080
tcpEndpoint, ok := n.TCPEndpoint()
8181
if !ok {
82-
return fmt.Errorf("node has no TCP endpoint")
82+
return errors.New("node has no TCP endpoint")
8383
}
8484
fd, err := net.Dial("tcp", tcpEndpoint.String())
8585
if err != nil {

p2p/enr/entries.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (v IPv4Addr) ENRKey() string { return "ip" }
177177
func (v IPv4Addr) EncodeRLP(w io.Writer) error {
178178
addr := netip.Addr(v)
179179
if !addr.Is4() {
180-
return fmt.Errorf("address is not IPv4")
180+
return errors.New("address is not IPv4")
181181
}
182182
enc := rlp.NewEncoderBuffer(w)
183183
bytes := addr.As4()
@@ -204,7 +204,7 @@ func (v IPv6Addr) ENRKey() string { return "ip6" }
204204
func (v IPv6Addr) EncodeRLP(w io.Writer) error {
205205
addr := netip.Addr(v)
206206
if !addr.Is6() {
207-
return fmt.Errorf("address is not IPv6")
207+
return errors.New("address is not IPv6")
208208
}
209209
enc := rlp.NewEncoderBuffer(w)
210210
bytes := addr.As16()

0 commit comments

Comments
 (0)