Skip to content

Commit

Permalink
simplify Operation function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Weber authored and gregwebs committed Jun 18, 2024
1 parent 05152b5 commit 52e8433
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ type HasOperation interface {
// It checks recursively for the HasOperation interface.
// Otherwise it will return the zero value (empty) string.
func Operation(v interface{}) string {
var operation string
if hasOp, ok := v.(HasOperation); ok {
operation = hasOp.GetOperation()
} else if un, ok := v.(unwrapper); ok {
return hasOp.GetOperation()
}
if un, ok := v.(unwrapper); ok {
return Operation(un.Unwrap())
}
return operation
return ""
}

// EmbedOp is designed to be embedded into your existing error structs.
Expand Down

0 comments on commit 52e8433

Please sign in to comment.