From ff4d3a7c75f686c0bce7f15c4bfe91d67687c0d0 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 5 Sep 2023 16:20:27 -0400 Subject: [PATCH] Remove unnecessarry if statements for operationWaiter errors (#8860) (#15724) Signed-off-by: Modular Magician --- .changelog/8860.txt | 3 +++ google/tpgresource/common_operation.go | 10 ++-------- 2 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 .changelog/8860.txt diff --git a/.changelog/8860.txt b/.changelog/8860.txt new file mode 100644 index 00000000000..0b7c86959b5 --- /dev/null +++ b/.changelog/8860.txt @@ -0,0 +1,3 @@ +```release-note:none +Remove unnecessary if statements for OperationWait +``` diff --git a/google/tpgresource/common_operation.go b/google/tpgresource/common_operation.go index cb96a10d0dd..ac0088e8ec8 100644 --- a/google/tpgresource/common_operation.go +++ b/google/tpgresource/common_operation.go @@ -140,10 +140,7 @@ func CommonRefreshFunc(w Waiter) resource.StateRefreshFunc { func OperationWait(w Waiter, activity string, timeout time.Duration, pollInterval time.Duration) error { if OperationDone(w) { - if w.Error() != nil { - return w.Error() - } - return nil + return w.Error() } c := &resource.StateChangeConf{ @@ -163,11 +160,8 @@ func OperationWait(w Waiter, activity string, timeout time.Duration, pollInterva if err != nil { return err } - if w.Error() != nil { - return w.Error() - } - return nil + return w.Error() } // The cloud resource manager API operation is an example of one of many