1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:24:39 -07:00

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 <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Rebecca Stambler 2019-02-20 17:23:36 -05:00
parent 97f80cd550
commit 191e9ce6ac

View File

@ -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 {