golang.org/x/tools@v0.21.0/internal/refactor/inline/testdata/err-shadow-pkg.txtar (about) 1 Test of failure to inline because callee references a 2 package-level decl that is shadowed by caller. 3 4 Observe that the first call to f can be inlined because 5 the shadowing has not yet occurred; but the second call 6 to f is within the scope of the local constant v. 7 8 -- go.mod -- 9 module testdata 10 go 1.12 11 12 -- a/a.go -- 13 package a 14 15 func _() { 16 f() //@ inline(re"f", result) 17 const v = 1 18 f() //@ inline(re"f", re"v.*shadowed.*by.*const.*line 5") 19 } 20 21 func f() int { return v } 22 23 var v int 24 25 -- result -- 26 package a 27 28 func _() { 29 _ = v //@ inline(re"f", result) 30 const v = 1 31 f() //@ inline(re"f", re"v.*shadowed.*by.*const.*line 5") 32 } 33 34 func f() int { return v } 35 36 var v int