From e1212569baaaf06e8764c7e3c2975af5a0f08da8 Mon Sep 17 00:00:00 2001 From: Rob Shakir Date: Thu, 2 Nov 2023 22:20:02 +0000 Subject: [PATCH] Add a `String` method to `OpResult`. * (M) rib/rib.go - Add a `String` helper method to `OpResult` to improve human readability. --- rib/rib.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rib/rib.go b/rib/rib.go index a982e2c7..4c87f9e1 100644 --- a/rib/rib.go +++ b/rib/rib.go @@ -354,6 +354,11 @@ type OpResult struct { Error string } +// String returns the OpResult as a human readable string. +func (o *OpResult) String() string { + return fmt.Sprintf("ID: %d, Type: %s, Error: %v") +} + // AddEntry adds the entry described in op to the network instance with name ni. It returns // two slices of OpResults: // - the first ("oks") describes the set of entries that were installed successfully based on