Hello,

Is:

type Y struct {

M string
N string

}

func initalize() Y{
// I have a func that return an object ob type Y.
}

var obj1 Y
go func() {
    obj1 = initalize()
}()

var obj2 Y
go func() {
    obj2 = initalize()
}()

What you are looking for?

Le lun. 6 mai 2019 à 13:59, Jan Mercl <0xj...@gmail.com> a écrit :

> On Mon, May 6, 2019 at 1:39 PM Nitish Saboo <nitish.sabo...@gmail.com>
> wrote:
>
> > type Y struct {
> >
> > M string
> > N string
> >
> > }
> >
> > func initalize() Y{
> > // I have a func that return an object ob type Y.
> > }
> > var obj1 Y  = go  initalize()
>
> No need to write Y above, the type will be inferred. However, see
> https://golang.org/ref/spec#Go_statements The go statement is not an
> expression while the `var foo = expr` requires an expression.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to