From 43345a118b9e68f7779914cc7a965a6b8a1d585e Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 4 Sep 2014 10:43:03 -0700 Subject: [PATCH] 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 --- src/pkg/go/parser/error_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pkg/go/parser/error_test.go b/src/pkg/go/parser/error_test.go index 8506077cee6..48fb53e5b0d 100644 --- a/src/pkg/go/parser/error_test.go +++ b/src/pkg/go/parser/error_test.go @@ -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)