From 8d82a394042feb858f8b8b40f199f9ede5cc1b83 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 4 Sep 2021 21:09:25 +1000 Subject: Make Operation generic From https://github.com/anacrolix/stm/commit/80e033aa1f2218b83fb5891671ed795de72e19d5 --- retry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'retry.go') diff --git a/retry.go b/retry.go index 1997b18..1adcfd0 100644 --- a/retry.go +++ b/retry.go @@ -11,7 +11,7 @@ var retries = pprof.NewProfile("stmRetries") var retry = &struct{}{} // catchRetry returns true if fn calls tx.Retry. -func catchRetry(fn Operation, tx *Tx) (result interface{}, gotRetry bool) { +func catchRetry[R any](fn Operation[R], tx *Tx) (result R, gotRetry bool) { defer func() { if r := recover(); r == retry { gotRetry = true -- cgit v1.2.3