Does cel-go support multiple returns?

55 views
Skip to first unread message

Aditya

unread,
Feb 1, 2023, 10:42:10 AM2/1/23
to CEL Go Discussion Forum
How would I use this go function inside cel env?

```
func Split(name string) (string, string) {
    return name, name + "suffix"
}
```

Tristan Swadell

unread,
Feb 1, 2023, 12:33:35 PM2/1/23
to Aditya, CEL Go Discussion Forum
Hi Aditya,

You would want to return a list of strings rather than perform a multiple return. 

return types.DefaultTypeAdapter.NativeToValue([]string{name, name + "suffix"})

-Tristan

--
You received this message because you are subscribed to the Google Groups "CEL Go Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cel-go-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cel-go-discuss/c32a0d1f-5fc5-45cf-8a7f-32ef69ea07f2n%40googlegroups.com.

Aditya

unread,
Feb 2, 2023, 6:01:21 AM2/2/23
to CEL Go Discussion Forum
Thanks Tristan
Reply all
Reply to author
Forward
0 new messages