1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:10:08 -07:00

go/parser: initialize file set even in only some tests are run

Without this fix, some tests crashed (e.g. go test -run Invalid).

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/133580043
This commit is contained in:
Robert Griesemer 2014-09-04 10:43:03 -07:00
parent fa9f3058e0
commit 43345a118b

View File

@ -34,7 +34,7 @@ import (
const testdata = "testdata"
var fsetErrs *token.FileSet
var fsetErrs = token.NewFileSet()
// getFile assumes that each filename occurs at most once
func getFile(filename string) (file *token.File) {
@ -169,7 +169,6 @@ func checkErrors(t *testing.T, filename string, input interface{}) {
}
func TestErrors(t *testing.T) {
fsetErrs = token.NewFileSet()
list, err := ioutil.ReadDir(testdata)
if err != nil {
t.Fatal(err)