[go-nuts] In `WaitGroup`, why should `Add(positive delta)` called before `Wait` if counter is 0?

2017-10-10 Thread Jay Guo
Hi, It is suggested in https://golang.org/pkg/sync/#WaitGroup that: // Note that calls with a positive delta that occur when the counter is zero // must happen before a Wait. I wonder what's the reason in terms of `sync` implementation. Essentially I'm trying to implement following logic: for

Re: [go-nuts] In `WaitGroup`, why should `Add(positive delta)` called before `Wait` if counter is 0?

2017-10-10 Thread Jay Guo
Yep. Thanks! cheers, - J On Tue, Oct 10, 2017 at 11:01 PM, Ian Lance Taylor <i...@golang.org> wrote: > On Tue, Oct 10, 2017 at 7:56 AM, Jay Guo <guojiannan1...@gmail.com> wrote: > > > > In my use case, both cases you presented are valid and I don't really > need

Re: [go-nuts] In `WaitGroup`, why should `Add(positive delta)` called before `Wait` if counter is 0?

2017-10-10 Thread Jay Guo
, 2017 at 9:42 PM, Ian Lance Taylor <i...@golang.org> wrote: > On Tue, Oct 10, 2017 at 5:34 AM, Jay Guo <guojiannan1...@gmail.com> wrote: > > > > It is suggested in https://golang.org/pkg/sync/#WaitGroup that: > > > > // Note that calls with a positive delt

[go-nuts] Struct members, hide or export?

2018-08-09 Thread Jay Guo
Let's say I'm writing some library for internal usage in my project, what's the idiomatic way to design visibility of struct members? - Option 1. export structs and members as much as possible. Only hide ones that need to be protected, e.g. by a lock - Option 2. hide as much as

[go-nuts] [Advice needed] How to vendor common dependencies for plugins

2018-03-07 Thread Jay Guo
Golang gurus, I'm currently trying to modularize my project with the help of Golang plugin, and I come across this dependency vendoring dilemma. Let's say we have a project layout: - Two different projects in separate repo: `Host` and `Guest` - `Host` depends on package `pkgA` -

[go-nuts] Re: [Advice needed] How to vendor common dependencies for plugins

2018-03-11 Thread Jay Guo
Bump.. any thoughts? Thanks! - J On Thursday, March 8, 2018 at 2:03:37 PM UTC+8, Jay Guo wrote: > > Golang gurus, > > I'm currently trying to modularize my project with the help of Golang > plugin, and I come across this dependency vendoring dilemma. > > Let's say we

Re: [go-nuts] Re: [Advice needed] How to vendor common dependencies for plugins

2018-03-19 Thread Jay Guo
ble. What > benefit do you expect to get from using them? > > On Sun, Mar 11, 2018 at 1:03 AM Jay Guo <guojiannan1...@gmail.com> wrote: > >> Bump.. any thoughts? Thanks! >> >> - J >> >> >> On Thursday, March 8, 2018 at 2:03:37 PM UTC+8, Jay Guo wrote: &