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 := GetAsOr[MyObj](services.GetServiceOr()) // Error: cannot 
initialize 1 variables with 2 values
```

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/308dd860-a980-449d-a710-201f074e4358n%40googlegroups.com.

Reply via email to