On Wed, Jul 26, 2017 at 02:46:08AM -0700, 370265...@qq.com wrote:

> > I think I can see at least one data race in your code. Try to run it using 
> > the race detector to verify.
> thanks.yes,i thought this before too,but string is basic type of golang,to 
> read and write the same variable of string should not case panic i think.

Implementing this would mean each access to each string variable would
need to use some sort of locking.  This is not tolerable as 99.9% of
code accessing variables of any type, including string, is not subject
for concurrency matters as such variables are confined to particular
goroutines.  Using automatic locking in such cases would cause
tremendous slowdowns for no reason.

That is, when you need concurrency, plan for concurrency and implement
it one way or another -- either through using channels or explicit
locking.

-- 
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 https://groups.google.com/d/optout.

Reply via email to