quot;. It has "variables", which is
>> *probably* what you mean.
>>
>> On Fri, Nov 25, 2022 at 10:55 AM Denis P wrote:
>>
>>> Thank you everyone for your help.
>>> The problem still exists.
>>> I am looking for a solution where s and s2
Thank you everyone for your help.
The problem still exists.
I am looking for a solution where s and s2 point to the same instance.
The current example proves they are different instances.
https://go.dev/play/p/_JyfJelhIy4
The main goal is to store any type in a wrapper and then get the reference
Ok, finally got it: https://go.dev/play/p/QFQOpqWsR6S
Thanks everyone, especially Axel
On Thursday, 24 November 2022 at 23:14:27 UTC Denis P wrote:
> Ok, looks like it doesn't work.
>
> I have got the following error:
> panic: interface conversion: interface {} is MyStruct, not
el.wa...@googlemail.com
wrote:
> Hi,
>
>
> On Thu, Nov 24, 2022 at 11:16 PM Denis P wrote:
>
>> Hi guys, tried to look everywhere and cannot find an answer.
>>
>> So literally I have this:
>> ```
>> var result interface{} = &MyStruct{}
>>
>>
Hi guys, tried to look everywhere and cannot find an answer.
So literally I have this:
```
var result interface{} = &MyStruct{}
...
return result.(*MyStruct) // Error: invalid operation: result (variable of
type *interface{}) is not an interface
```
Is there any way to get the &MyStruct as a
Hi guys,
I am struggling with making my code work in a way that multiple methods
called in multiline approach. Does any gopher has an answer is there any
solution to this:
```
type MyStuff struct { }
func CreateMyStuff() MyStuff {}
func (s MyStuff) DoJobOne() MyStuff {}
func (s MyStuff) DoJob
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()