Re: [go-nuts] cannot initialize 1 variables with 2 values

2022-11-23 Thread Kurtis Rader
Perhaps explicitly capture the error value? That is, result, err := GetAsOr[MyObj](services.GetServiceOr()) Alternatively, if you don't care if there is an error replace "err" with "_" to make that clear. On Wed, Nov 23, 2022 at 4:34 PM Denis P wrote: > Hi guys, > > Does anyone know how to

[go-nuts] cannot initialize 1 variables with 2 values

2022-11-23 Thread Denis P
Hi guys, Does anyone know how to pass it properly and without adding extra lines of code? ``` func GetAsOr[T any](t interface{}, e error) (T, error) { return t.(T), e } func (s ServiceProvider) GetServiceOr() (interface{}, error) { } result :=