Hi go nuts,

https://play.golang.org/p/ylYlbVMQ24-


I recently hit an error where I had been calling methods on a struct.  
 Originally, the fields in the struct were never changed, but after some 
iterations, i added some state to my struct.  The methods which modified 
the state were always working on a copy (like in the example above), which 
caused the resulting modification to be thrown away.   

Would it be possible to make such assignments be a vet warning?  For cases 
like _ = foo, the intent of the programmer is clear to throw a value 
away).  But in the case of the example, its more likely a bug.  In fact, I 
can't see any legitimate reason to assign to a struct value, (unless it is 
read later).   

-- 
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