aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gocapturedrefrace.go1
-rw-r--r--testdata/simple.go12
2 files changed, 13 insertions, 0 deletions
diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go
index f3e2e81..517cf8e 100644
--- a/gocapturedrefrace.go
+++ b/gocapturedrefrace.go
@@ -56,6 +56,7 @@ func checkClosure(pass *analysis.Pass, funcLit *ast.FuncLit) {
formalParams = append(formalParams, field.Names[0].Obj)
}
fmt.Printf("%#v\n", formalParams)
+ // TODO: Ensure argument types are not references
// TODO: Build a list of variables created in the closure
assignments := assignmentsInFunc(pass, funcLit)
diff --git a/testdata/simple.go b/testdata/simple.go
index 0a2f0af..d01a95e 100644
--- a/testdata/simple.go
+++ b/testdata/simple.go
@@ -23,3 +23,15 @@ func main() {
strings.Repeat(str, 3)
}(copied)
}
+
+func argumentReference() {
+ type aStruct struct{
+ field int
+ }
+
+ s := aStruct{field: 0}
+
+ go func(s *aStruct) {
+ s.field += 1
+ }(&s)
+}