Re: [go-nuts] Question on handling Data Race

2021-09-12 Thread Martin Schnabel
hi Michael, from my understanding: if you only call refresh from somefunc and locking the body should be fine. however i strongly advise not to export refresh, otherwise it is a broken api. and someone, someday will call refresh without that lock. if refresh should be part of the accessible

Re: [go-nuts] Question on handling Data Race

2021-09-11 Thread Kurtis Rader
On Sat, Sep 11, 2021 at 6:49 PM Michael Dwyer wrote: > Kurtis, > > I realized this question would arise. > Presently working with an existing code base. > The code presented in the example is a close approximation to what > actually exists, the only thing changed were the names. > Additionally,

Re: [go-nuts] Question on handling Data Race

2021-09-11 Thread Michael Dwyer
Kurtis, I realized this question would arise. Presently working with an existing code base. The code presented in the example is a close approximation to what actually exists, the only thing changed were the names. Additionally, I checked the package and the call order is SomeFunc() ->

Re: [go-nuts] Question on handling Data Race

2021-09-11 Thread Kurtis Rader
On Sat, Sep 11, 2021 at 5:01 PM Michael Dwyer wrote: > Presently working on a Data Race and have some questions on how to proceed. > The code example is a hypothetical mock up of the actual code under > review, but is a fair representation. > > The struct used by both functions is named Foo. >

[go-nuts] Question on handling Data Race

2021-09-11 Thread Michael Dwyer
Presently working on a Data Race and have some questions on how to proceed. The code example is a hypothetical mock up of the actual code under review, but is a fair representation. The struct used by both functions is named Foo. In the hypothetical, SomeFunc() reads variable from foo.bar,