I don't see anything fundamentally wrong with using a *sync.Mutex as long
as users always use New(). It allows Set to be passed by value, which is
nice.
But if you keep the mutex as a non pointer, then you probably want to pass
a slice of set pointers:
func (set *Set) Diff(sets []*Set) *Set
Th
I want an slice of sets
On Tuesday, August 7, 2018 at 6:32:25 PM UTC+5:30, Dave Cheney wrote:
>
> Pass a pointer, *Set into your Diff method.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emai
Pass a pointer, *Set into your Diff method.
--
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 htt
Error is gone when used
mux *sync.Mutex
On Tuesday, August 7, 2018 at 6:12:26 PM UTC+5:30, Kasun Vithanage wrote:
>
> I'm implementing some thread safe data structures
>
> type Set struct {
>m map[string]int
>mux sync.Mutex
> }
>
>
> func New() *Set {
>return &Set{m: make(map[str