1
0
mirror of https://github.com/golang/go synced 2024-10-05 06:21:24 -06:00
go/src/pkg/sync
Russ Cox d03611f628 allow copy of struct containing unexported fields
An experiment: allow structs to be copied even if they
contain unexported fields.  This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.

In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.

All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.

Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef

R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
2011-11-15 12:20:59 -05:00
..
atomic sync/atomic: replace MFENCE with LOCK XADD 2011-09-19 11:09:00 -07:00
cond_test.go sync: always wake up previously sleeping goroutines on Cond.Signal 2011-06-01 20:30:42 -03:00
cond.go sync: always wake up previously sleeping goroutines on Cond.Signal 2011-06-01 20:30:42 -03:00
Makefile sync: use sync/atomic 2011-02-25 14:29:47 -05:00
mutex_test.go go/printer: changed max. number of newlines from 3 to 2 2011-07-14 14:39:40 -07:00
mutex.go allow copy of struct containing unexported fields 2011-11-15 12:20:59 -05:00
once_test.go all: sort imports 2011-11-02 15:54:16 -04:00
once.go sync: improve Once fast path 2011-07-21 11:30:14 -04:00
rwmutex_test.go sync: improve RWMutex performance 2011-07-12 09:24:21 -07:00
rwmutex.go sync: improve RWMutex performance 2011-07-12 09:24:21 -07:00
waitgroup_test.go sync: add fast paths to WaitGroup 2011-07-18 12:35:55 -04:00
waitgroup.go sync: add fast paths to WaitGroup 2011-07-18 12:35:55 -04:00