dashboard: add sanity check

Because almost all the BuildConfig methods indirectly call AllScript,
add in a little defense against accident creation of BuildConfig zero
values (of the value type, not nil pointers). This can happen by doing
a lookup in a map[string]dashboard.BuildConfig and then calling a
method on it. We should probably move everything to pointer values of
BuildConfig. There aren't many value types remaining.

This paranoia isn't a result of any bug yet, but rather than the result
of discussion on CL 40477.

Change-Id: Ic273d4de28ac8930b56bc232bf77a9ba39f99fad
Reviewed-on: https://go-review.googlesource.com/40497
Reviewed-by: Herbie Ong <herbie@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index a77373c..39ea2a5 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -491,6 +491,9 @@
 // do the build and run its standard set of tests.
 // Example values are "src/all.bash", "src/all.bat", "src/all.rc".
 func (c *BuildConfig) AllScript() string {
+	if c.Name == "" {
+		panic("bogus BuildConfig")
+	}
 	if c.IsRace() {
 		if strings.HasPrefix(c.Name, "windows-") {
 			return "src/race.bat"