On Tue, 2023-05-30 at 08:42 -0700, 'Tristan Swadell' via CEL Go
Discussion Forum wrote:
> Hi Dan,
>
> The `ProgramOptions()` are still useful for decorators and for
> turning on some specific runtime validation checks, but if you don't
> have any to specify just return an empty list. The code could
> probably be more robust and skip options which are nil, but in
> general the code expects a slice of size 0 or more.
>
> func (lib) ProgramOptions() []cel.ProgramOption { return
> []cel.ProgramOption{} }
>
> Cheers,
>
> -Tristan
>
Thanks, Tristan.
From the code, a nil return should be fine. AFAICS the only call is in
func Lib(l Library) EnvOption where the return is appended to
cel.Env.progOpts, and append([]T, []T(nil)) is a valid no-op in Go.
Dan