aboutsummaryrefslogtreecommitdiffstats
path: root/testdata/shadow.go
diff options
context:
space:
mode:
authorTeddy Wing2023-05-18 03:40:44 +0200
committerTeddy Wing2023-05-18 03:44:52 +0200
commitc76dd021f7a3df0f524b8c9e8e710950a0b31fb6 (patch)
tree07a839229c0df953b1a4d652933897a9b495394f /testdata/shadow.go
parentf0aece52e7d41c404f5a3dbcbe174b43351cb25f (diff)
downloadgocapturedrefrace-c76dd021f7a3df0f524b8c9e8e710950a0b31fb6.tar.bz2
varDeclaration: Return all identifiers in declaration
Declarations can include multiple identifiers. Return all of these from the function and rename it accordingly.
Diffstat (limited to 'testdata/shadow.go')
-rw-r--r--testdata/shadow.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/testdata/shadow.go b/testdata/shadow.go
index 023df57..a8c2b5f 100644
--- a/testdata/shadow.go
+++ b/testdata/shadow.go
@@ -31,3 +31,23 @@ func shadow() {
}
}()
}
+
+func multiIdentifierDeclaration() {
+ var err1, err2 error
+ err1 = nil
+ err2 = nil
+ if err1 != nil || err2 != nil {
+ log.Print(err1, err2)
+ }
+
+ go func() {
+ // err1 and err2 are redeclared here and shadow the outer scope. No
+ // diagnostic should be printed.
+ var err1, err2 error
+ err1 = errors.New("shadowing declaration err1")
+ err2 = errors.New("shadowing declaration err2")
+ if err1 != nil || err2 != nil {
+ log.Print(err1, err2)
+ }
+ }()
+}