We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4ba09f commit 9b85096Copy full SHA for 9b85096
workflow/worker.go
@@ -20,6 +20,7 @@ import (
20
"fmt"
21
"log"
22
"reflect"
23
+ "regexp"
24
"runtime"
25
"strings"
26
@@ -90,10 +91,15 @@ func getFunctionName(f interface{}) (string, error) {
90
91
}
92
93
callSplit := strings.Split(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), ".")
-
94
funcName := callSplit[len(callSplit)-1]
95
96
- if funcName == "1" {
+ const anonymousFunctionRegxp = "^func[0-9]+$"
97
+ isAnonymousFunc, err := regexp.MatchString(anonymousFunctionRegxp, funcName)
98
+ if err != nil {
99
+ return "", fmt.Errorf("failed to match anonymous function regexp: %w", err)
100
+ }
101
+
102
+ if isAnonymousFunc {
103
return "", errors.New("anonymous function name")
104
105
0 commit comments