aboutsummaryrefslogtreecommitdiffstats
path: root/testdata
diff options
context:
space:
mode:
authorTeddy Wing2023-05-15 21:44:54 +0200
committerTeddy Wing2023-05-15 21:44:54 +0200
commita3515d6d5d52a84944b5bd0aaa863a50b3c1ec59 (patch)
treef93e0144b253d904f617fc19b0cf785b4760629f /testdata
parent0bd0a462ab4e733e62678d847b88a36ce95130f8 (diff)
downloadgocapturedrefrace-a3515d6d5d52a84944b5bd0aaa863a50b3c1ec59.tar.bz2
Add test for reference arguments
These should be reported as well, because they're shared references even though they're passed as arguments. This currently reports the variable name as "aStruct", will need to look into how to correct that.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/simple.go12
1 files changed, 12 insertions, 0 deletions
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)
+}