From 536e01459af36211436dfaa0d8ee03f13856ffca Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 14 Aug 2025 14:27:37 +0200 Subject: [PATCH] chore: simplify --- tariff/helper.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tariff/helper.go b/tariff/helper.go index 383e62e51..fff04784f 100644 --- a/tariff/helper.go +++ b/tariff/helper.go @@ -72,16 +72,14 @@ func beginningOfDay() time.Time { return now.With(time.Now()).BeginningOfDay() } -type runnable interface { +type runnable[T any] interface { + *T run(done chan error) } // https://groups.google.com/g/golang-nuts/c/1cl9v_hPYHk // runOrError invokes t.run(chan error) and waits for the channel to return -func runOrError[T any, I interface { - *T - runnable -}](t I) (*T, error) { +func runOrError[T any, I runnable[T]](t I) (*T, error) { done := make(chan error) go t.run(done)