From 191e9ce6ac8f89353b648c1a5142589d496d774d Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Wed, 20 Feb 2019 17:23:36 -0500 Subject: [PATCH] go/gcexportdata: switch constant used in tests text/scanner was used in tests because it was unlikely to change between releases, but of course, a line number changed, breaking the tests. Use a different constant for testing that remained on the same line. Change-Id: I41425728e0918ffe388b3c8df9fd71e8371eb38e Reviewed-on: https://go-review.googlesource.com/c/163197 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Julie Qiu --- go/gcexportdata/example_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/go/gcexportdata/example_test.go b/go/gcexportdata/example_test.go index b67d55f9..3a205abf 100644 --- a/go/gcexportdata/example_test.go +++ b/go/gcexportdata/example_test.go @@ -75,7 +75,7 @@ func ExampleNewImporter() { // choosing a package that is unlikely to change across releases import "text/scanner" -const eof = scanner.EOF +const scanIdents = scanner.ScanIdents ` fset := token.NewFileSet() f, err := parser.ParseFile(fset, "myscanner.go", src, 0) @@ -92,7 +92,7 @@ const eof = scanner.EOF } // object from imported package - pi := packages["text/scanner"].Scope().Lookup("EOF") + pi := packages["text/scanner"].Scope().Lookup("ScanIdents") fmt.Printf("const %s.%s %s = %s // %s\n", pi.Pkg().Path(), pi.Name(), @@ -102,7 +102,7 @@ const eof = scanner.EOF ) // object in source package - twopi := pkg.Scope().Lookup("eof") + twopi := pkg.Scope().Lookup("scanIdents") fmt.Printf("const %s %s = %s // %s\n", twopi.Name(), twopi.Type(), @@ -112,8 +112,8 @@ const eof = scanner.EOF // Output: // - // const text/scanner.EOF untyped int = -1 // $GOROOT/src/text/scanner/scanner.go:75:1 - // const eof untyped int = -1 // myscanner.go:6:7 + // const text/scanner.ScanIdents untyped int = 4 // $GOROOT/src/text/scanner/scanner.go:62:1 + // const scanIdents untyped int = 4 // myscanner.go:6:7 } func slashify(posn token.Position) token.Position {