go/gcexportdata: fix gcexportdata example for new compiler behavior
Initialization changes in https://go-review.googlesource.com/c/go/+/161337 added a symbol, which was not 'expected output'. Adjusted behavior to conform to expectations, since older Go versions must continue to pass. Fixes golang/go#30912. Change-Id: If2f27ea29e20a03c5412f1999711a9208c3ca470 Reviewed-on: https://go-review.googlesource.com/c/tools/+/168397 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
bb1270c20e
commit
3f1ed9edd1
|
@ -51,7 +51,12 @@ func ExampleRead() {
|
|||
}
|
||||
|
||||
// Print package information.
|
||||
fmt.Printf("Package members: %s...\n", pkg.Scope().Names()[:5])
|
||||
members := pkg.Scope().Names()
|
||||
if members[0] == ".inittask" {
|
||||
// An improvement to init handling in 1.13 added ".inittask". Remove so go >= 1.13 and go < 1.13 both pass.
|
||||
members = members[1:]
|
||||
}
|
||||
fmt.Printf("Package members: %s...\n", members[:5])
|
||||
println := pkg.Scope().Lookup("Println")
|
||||
posn := fset.Position(println.Pos())
|
||||
posn.Line = 123 // make example deterministic
|
||||
|
|
Loading…
Reference in New Issue