From 0f56c9d00caf90c835a885b5c83778decc3885c6 Mon Sep 17 00:00:00 2001 From: Eiichiro Watanabe Date: Wed, 14 Oct 2015 16:28:11 +0900 Subject: *: fix Errorf call with missing format verbs --- gobgp/cmd/mrt.go | 4 ++-- packet/bgp.go | 14 +++++++------- server/server.go | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gobgp/cmd/mrt.go b/gobgp/cmd/mrt.go index 65fb6452..55ccf11e 100644 --- a/gobgp/cmd/mrt.go +++ b/gobgp/cmd/mrt.go @@ -317,13 +317,13 @@ func injectMrt(r string, filename string, count int) error { stream, err := client.ModPath(context.Background()) if err != nil { - return fmt.Errorf("failed to modpath:", err) + return fmt.Errorf("failed to modpath: %s", err) } for arg := range ch { err = stream.Send(arg) if err != nil { - return fmt.Errorf("failed to send:", err) + return fmt.Errorf("failed to send: %s", err) } } diff --git a/packet/bgp.go b/packet/bgp.go index 69f74e0e..83d6a713 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -1595,7 +1595,7 @@ func (er *EVPNMacIPAdvertisementRoute) DecodeFromBytes(data []byte) error { if er.IPAddressLength == 32 || er.IPAddressLength == 128 { er.IPAddress = net.IP(data[0:((er.IPAddressLength) / 8)]) } else if er.IPAddressLength != 0 { - return fmt.Errorf("Invalid IP address length", er.IPAddressLength) + return fmt.Errorf("Invalid IP address length: %d", er.IPAddressLength) } data = data[(er.IPAddressLength / 8):] label1 := labelDecode(data) @@ -1644,7 +1644,7 @@ func (er *EVPNMacIPAdvertisementRoute) Serialize() ([]byte, error) { } buf = append(buf, []byte(er.IPAddress)...) } else { - return nil, fmt.Errorf("Invalid IP address length", er.IPAddressLength) + return nil, fmt.Errorf("Invalid IP address length: %d", er.IPAddressLength) } for _, l := range er.Labels { @@ -1697,7 +1697,7 @@ func (er *EVPNMulticastEthernetTagRoute) DecodeFromBytes(data []byte) error { if er.IPAddressLength == 32 || er.IPAddressLength == 128 { er.IPAddress = net.IP(data[:er.IPAddressLength/8]) } else { - return fmt.Errorf("Invalid IP address length", er.IPAddressLength) + return fmt.Errorf("Invalid IP address length: %d", er.IPAddressLength) } return nil } @@ -1723,7 +1723,7 @@ func (er *EVPNMulticastEthernetTagRoute) Serialize() ([]byte, error) { } buf = append(buf, []byte(er.IPAddress)...) } else { - return nil, fmt.Errorf("Invalid IP address length", er.IPAddressLength) + return nil, fmt.Errorf("Invalid IP address length: %d", er.IPAddressLength) } if err != nil { return nil, err @@ -1768,7 +1768,7 @@ func (er *EVPNEthernetSegmentRoute) DecodeFromBytes(data []byte) error { if er.IPAddressLength == 32 || er.IPAddressLength == 128 { er.IPAddress = net.IP(data[:er.IPAddressLength/8]) } else { - return fmt.Errorf("Invalid IP address length", er.IPAddressLength) + return fmt.Errorf("Invalid IP address length: %d", er.IPAddressLength) } return nil } @@ -1796,7 +1796,7 @@ func (er *EVPNEthernetSegmentRoute) Serialize() ([]byte, error) { } buf = append(buf, []byte(er.IPAddress)...) } else { - return nil, fmt.Errorf("Invalid IP address length", er.IPAddressLength) + return nil, fmt.Errorf("Invalid IP address length: %d", er.IPAddressLength) } return buf, nil } @@ -1840,7 +1840,7 @@ func getEVPNRouteType(t uint8) (EVPNRouteTypeInterface, error) { case EVPN_ETHERNET_SEGMENT_ROUTE: return &EVPNEthernetSegmentRoute{}, nil } - return nil, fmt.Errorf("Unknown EVPN Route type", t) + return nil, fmt.Errorf("Unknown EVPN Route type: %d", t) } const ( diff --git a/server/server.go b/server/server.go index 7a5d1c86..3aff34a6 100644 --- a/server/server.go +++ b/server/server.go @@ -1160,7 +1160,7 @@ func (server *BgpServer) handleVrfMod(arg *api.ModVrfArguments) ([]*table.Path, return nil, err } default: - return nil, fmt.Errorf("unknown operation:", arg.Operation) + return nil, fmt.Errorf("unknown operation: %d", arg.Operation) } return msgs, nil } @@ -1215,7 +1215,7 @@ func (server *BgpServer) handleVrfRequest(req *GrpcRequest) []*table.Path { arg := req.Data.(*api.ModVrfArguments) msgs, result.ResponseErr = server.handleVrfMod(arg) default: - result.ResponseErr = fmt.Errorf("unknown request type:", req.RequestType) + result.ResponseErr = fmt.Errorf("unknown request type: %d", req.RequestType) } req.ResponseCh <- result -- cgit v1.2.3