1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:38:32 -06:00

go/packages: make a test Errorf into Fatalf

It is a bounds check on an array before an access, the test cannot
continue safely if it fails, so it should be fatal.

Change-Id: Icd081df9cb81d549519d69bd34739d950946ccf5
Reviewed-on: https://go-review.googlesource.com/126975
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Cottrell 2018-07-31 15:06:28 -04:00
parent 9e9f7f69ec
commit 33176b2029

View File

@ -376,7 +376,7 @@ package b`,
t.Error(err)
}
if len(initial) != 1 {
t.Errorf("test tags %v: pattern %s, expected 1 package, got %d packages.", test.tags, test.pattern, len(initial))
t.Fatalf("test tags %v: pattern %s, expected 1 package, got %d packages.", test.tags, test.pattern, len(initial))
}
pkg := initial[0]
if srcs := strings.Join(srcs(pkg), " "); srcs != test.wantSrcs {