Skip to content

Commit

Permalink
Add a String method to OpResult.
Browse files Browse the repository at this point in the history
 * (M) rib/rib.go
   - Add a `String` helper method to `OpResult` to improve human
     readability.
  • Loading branch information
robshakir committed Nov 2, 2023
1 parent 594d43a commit e121256
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rib/rib.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check failure on line 359 in rib/rib.go

View workflow job for this annotation

GitHub Actions / go / Static Analysis

fmt.Sprintf format %d reads arg #1, but call has 0 args

Check failure on line 359 in rib/rib.go

View workflow job for this annotation

GitHub Actions / go / Static Analysis

fmt.Sprintf format %d reads arg #1, but call has 0 args

Check failure on line 359 in rib/rib.go

View workflow job for this annotation

GitHub Actions / go / staticcheck

Printf format %d reads arg #1, but call has only 0 args (SA5009)

Check failure on line 359 in rib/rib.go

View workflow job for this annotation

GitHub Actions / go / Build and Test (stable)

fmt.Sprintf format %d reads arg #1, but call has 0 args

Check failure on line 359 in rib/rib.go

View workflow job for this annotation

GitHub Actions / go / Build and Test (oldstable)

fmt.Sprintf format %d reads arg #1, but call has 0 args
}

// 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
Expand Down

0 comments on commit e121256

Please sign in to comment.