On Wed, Dec 4, 2019 at 1:55 PM <cstige...@gmail.com> wrote:

> Hello Golang nuts group.
>
> I've tested golang's slice and got a weird result.
>
> Anyone can explain it?
>
>
> Why the ID of struct in the go-routine refer same address?
>



On this mailing list please just send code as plain text or as a link to
the Go playground.  Please don't send a picture of code.  That is much
harder to read and to use.

Unfortunately I don't really understand your question.  You are passing the
same pointer to the goroutine each time, so why wouldn't &a.ID be the same
in each goroutine?  That's how pointers work.

Ian

-- 
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/CAOyqgcV2sK%2Bb2RUWyUUciGwD4KTXP9G%3DATTk%3Dm_ca3E6-hCBhQ%40mail.gmail.com.

Reply via email to