Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-20 Thread Robert Engels
nt: Jun 20, 2019 2:46 AM To: Michael Jones Cc: Robert Engels , golang-nuts , jake6...@gmail.com Subject: Re: [go-nuts] Re: is there a goroutine scope global veriable ? On a practical note I think thread local storage is more or less discouraged in for example Java as wellbecause it makes all the

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-20 Thread Henrik Johansson
you have. >> >> >> -Original Message- >> From: jake6...@gmail.com >> Sent: Jun 19, 2019 11:08 AM >> To: golang-nuts >> Subject: [go-nuts] Re: is there a goroutine scope global veriable ? >> >> This has been discussed many times before. Se

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread Michael Jones
u make do with what you have. > > > -Original Message- > From: jake6...@gmail.com > Sent: Jun 19, 2019 11:08 AM > To: golang-nuts > Subject: [go-nuts] Re: is there a goroutine scope global veriable ? > > This has been discussed many times before. Searching "local st

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread Robert Engels
t you have.-Original Message- From: jake6...@gmail.com Sent: Jun 19, 2019 11:08 AM To: golang-nuts Subject: [go-nuts] Re: is there a goroutine scope global veriable ? This has been discussed many times before. Searching "local storage" on this group brings up many discussi

[go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread jake6502
This has been discussed many times before. Searching "local storage" on this group brings up many discussions, including: https://groups.google.com/d/topic/golang-nuts/Nt0hVV_nqHE/discussion https://groups.google.com/d/topic/golang-nuts/_Vv7Bzn8yH4/discussion

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread hui zhang
this implement does not solve the problem. still need pass the parameter in all functions. func (g *gls) run()orfunc run (g *gls) 在 2019年6月19日星期三 UTC+8下午4:55:09,Jan Mercl写道: > > On Wed, Jun 19, 2019 at 10:41 AM hui zhang > wrote: > > > but, very few document mention , how to do it as

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread Jan Mercl
On Wed, Jun 19, 2019 at 11:15 AM hui zhang wrote: > Is there a golang context way to do it? Some bits are at https://golang.org/pkg/context/#pkg-examples -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread hui zhang
thank you very much. Is there a golang context way to do it? 在 2019年6月19日星期三 UTC+8下午4:55:09,Jan Mercl写道: > > On Wed, Jun 19, 2019 at 10:41 AM hui zhang > wrote: > > > but, very few document mention , how to do it as goroutine local storage > . Can anyone give an example to solve my problem

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread Jan Mercl
On Wed, Jun 19, 2019 at 10:41 AM hui zhang wrote: > but, very few document mention , how to do it as goroutine local storage . > Can anyone give an example to solve my problem , refer the code I attached? Make the goroutine a method of a struct that contains any context the goroutine needs.

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread hui zhang
thanks , I also google blew links. It is called goroutine local storage (gls) and many third party implement(https://github.com/jtolds/gls) however, the golang official suggest to use go context. but, very few document mention , how to do it as goroutine local storage . Can anyone give an

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-19 Thread Jan Mercl
On Wed, Jun 19, 2019 at 4:55 AM hui zhang wrote: > is there a goroutine scope global veriable ? so I can do this ? Go has no global scope. The closest is universe scope but that scope contains only predeclared identifiers. I think you are meaning package scope. Goroutines can access

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-18 Thread Kurtis Rader
On Tue, Jun 18, 2019 at 7:56 PM hui zhang wrote: > > is there a goroutine scope global veriable ? so I can do this ? > You're asking if Go supports the equivalent of thread local storage as used in Java, C++, and Python. The answer is, no. See

[go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-18 Thread hui zhang
is there a goroutine scope global veriable ? like fork a variable from main ? -- 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

[go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-18 Thread hui zhang
is there a goroutine scope global veriable ? so I can do this ? -- 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