-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Milestone
Description
by RyanneDolan:
What steps will reproduce the problem? v := new(struct{i int}) v.i = 1 What is the expected output? What do you see instead? Should get "v declared and not used" error. Instead, compiles fine. What is your $GOOS? $GOARCH? linux/386 Which revision are you using? (hg identify) 54392bd03d06 tip Please provide any additional information below. The dot operator should mark its left operand as "used" only when it appears on the RHS. a = 1 // 'a' is not marked as used (CORRECT) v.i = 1 // 'v' is marked as used (WRONG) a = v.i // 'v' is marked as used (CORRECT) This bug is important to fix for consistency, and because it confuses new programmers who might expect reference semantics: for _,v := range arr {v.i = 1} // doesn't do anything Mentioned here: http://groups.google.com/group/golang- nuts/browse_thread/thread/342fe61c78916496/fbb57f693f1aca72
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted