single argument panic

note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.

stop on error in doc/progs/run

R=r
CC=golang-dev
https://golang.org/cl/850041
diff --git a/src/cmd/cgo/ast.go b/src/cmd/cgo/ast.go
index 1bde1b7..0dfe921 100644
--- a/src/cmd/cgo/ast.go
+++ b/src/cmd/cgo/ast.go
@@ -157,7 +157,7 @@
 	// everything else just recurs
 	default:
 		error(noPos, "unexpected type %T in walk", x)
-		panic()
+		panic("unexpected type")
 
 	case nil:
 
diff --git a/src/cmd/godoc/index.go b/src/cmd/godoc/index.go
index d6fdba1..aa108d0 100644
--- a/src/cmd/godoc/index.go
+++ b/src/cmd/godoc/index.go
@@ -119,7 +119,7 @@
 	// sanity check: if nKinds is too large, the SpotInfo
 	// accessor functions may need to be updated
 	if nKinds > 8 {
-		panic()
+		panic("nKinds > 8")
 	}
 }
 
diff --git a/src/cmd/goinstall/download.go b/src/cmd/goinstall/download.go
index 13a2f65..df1cde6 100644
--- a/src/cmd/goinstall/download.go
+++ b/src/cmd/goinstall/download.go
@@ -55,7 +55,7 @@
 			v = &svn
 		default:
 			// regexp only allows hg, svn to get through
-			panic("missing case in download: ", pkg)
+			panic("missing case in download: " + pkg)
 		}
 		if err := vcsCheckout(v, root+m[1], "http://"+m[1], m[1]); err != nil {
 			return "", err
diff --git a/src/pkg/bufio/bufio.go b/src/pkg/bufio/bufio.go
index 9b52a36..1af9545 100644
--- a/src/pkg/bufio/bufio.go
+++ b/src/pkg/bufio/bufio.go
@@ -75,7 +75,7 @@
 	b, err := NewReaderSize(rd, defaultBufSize)
 	if err != nil {
 		// cannot happen - defaultBufSize is a valid size
-		panic("bufio: NewReader: ", err.String())
+		panic(err)
 	}
 	return b
 }
@@ -353,7 +353,7 @@
 	b, err := NewWriterSize(wr, defaultBufSize)
 	if err != nil {
 		// cannot happen - defaultBufSize is valid size
-		panic("bufio: NewWriter: ", err.String())
+		panic(err)
 	}
 	return b
 }
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go
index efec1eb..df55ce3 100644
--- a/src/pkg/bytes/bytes_test.go
+++ b/src/pkg/bytes/bytes_test.go
@@ -188,7 +188,8 @@
 	for i := 0; i < b.N; i++ {
 		j := index(buf, 'x')
 		if j != n-1 {
-			panic("bad index", j)
+			println("bad index", j)
+			panic("bad index")
 		}
 	}
 	buf[n-1] = '0'
diff --git a/src/pkg/crypto/block/cmac.go b/src/pkg/crypto/block/cmac.go
index a2f80fe..6082299 100644
--- a/src/pkg/crypto/block/cmac.go
+++ b/src/pkg/crypto/block/cmac.go
@@ -37,7 +37,7 @@
 	case 128 / 8:
 		r = r128
 	default:
-		panic("crypto/block: NewCMAC: invalid cipher block size", n)
+		panic("crypto/block: NewCMAC: invalid cipher block size")
 	}
 
 	d := new(cmac)
diff --git a/src/pkg/exp/eval/eval_test.go b/src/pkg/exp/eval/eval_test.go
index 911c7e4..837c4fa 100644
--- a/src/pkg/exp/eval/eval_test.go
+++ b/src/pkg/exp/eval/eval_test.go
@@ -196,7 +196,7 @@
 		return &funcV{val}
 	}
 	log.Crashf("toValue(%T) not implemented", val)
-	panic()
+	panic("unreachable")
 }
 
 /*
diff --git a/src/pkg/exp/eval/expr.go b/src/pkg/exp/eval/expr.go
index 5547aee..e630578 100644
--- a/src/pkg/exp/eval/expr.go
+++ b/src/pkg/exp/eval/expr.go
@@ -642,7 +642,7 @@
 		return ei.compileUnaryExpr(x.Op, v)
 	}
 	log.Crashf("unexpected ast node type %T", x)
-	panic()
+	panic("unreachable")
 
 typeexpr:
 	if !callCtx {
@@ -704,7 +704,7 @@
 		return nil
 	}
 	log.Crashf("name %s has unknown type %T", name, def)
-	panic()
+	panic("unreachable")
 }
 
 func (a *exprInfo) compileVariable(level int, v *Variable) *expr {
@@ -1424,7 +1424,7 @@
 	}
 
 	log.Crashf("unexpected built-in function '%s'", ft.builtin)
-	panic()
+	panic("unreachable")
 }
 
 func (a *exprInfo) compileStarExpr(v *expr) *expr {
diff --git a/src/pkg/exp/eval/expr1.go b/src/pkg/exp/eval/expr1.go
index 28da8ee..0e83053 100644
--- a/src/pkg/exp/eval/expr1.go
+++ b/src/pkg/exp/eval/expr1.go
@@ -12,9 +12,15 @@
  * "As" functions.  These retrieve evaluator functions from an
  * expr, panicking if the requested evaluator has the wrong type.
  */
-func (a *expr) asBool() func(*Thread) bool   { return a.eval.(func(*Thread) bool) }
-func (a *expr) asUint() func(*Thread) uint64 { return a.eval.(func(*Thread) uint64) }
-func (a *expr) asInt() func(*Thread) int64   { return a.eval.(func(*Thread) int64) }
+func (a *expr) asBool() func(*Thread) bool {
+	return a.eval.(func(*Thread) bool)
+}
+func (a *expr) asUint() func(*Thread) uint64 {
+	return a.eval.(func(*Thread) uint64)
+}
+func (a *expr) asInt() func(*Thread) int64 {
+	return a.eval.(func(*Thread) int64)
+}
 func (a *expr) asIdealInt() func() *bignum.Integer {
 	return a.eval.(func() *bignum.Integer)
 }
@@ -33,10 +39,18 @@
 func (a *expr) asStruct() func(*Thread) StructValue {
 	return a.eval.(func(*Thread) StructValue)
 }
-func (a *expr) asPtr() func(*Thread) Value   { return a.eval.(func(*Thread) Value) }
-func (a *expr) asFunc() func(*Thread) Func   { return a.eval.(func(*Thread) Func) }
-func (a *expr) asSlice() func(*Thread) Slice { return a.eval.(func(*Thread) Slice) }
-func (a *expr) asMap() func(*Thread) Map     { return a.eval.(func(*Thread) Map) }
+func (a *expr) asPtr() func(*Thread) Value {
+	return a.eval.(func(*Thread) Value)
+}
+func (a *expr) asFunc() func(*Thread) Func {
+	return a.eval.(func(*Thread) Func)
+}
+func (a *expr) asSlice() func(*Thread) Slice {
+	return a.eval.(func(*Thread) Slice)
+}
+func (a *expr) asMap() func(*Thread) Map {
+	return a.eval.(func(*Thread) Map)
+}
 func (a *expr) asMulti() func(*Thread) []Value {
 	return a.eval.(func(*Thread) []Value)
 }
@@ -72,7 +86,7 @@
 	default:
 		log.Crashf("unexpected expression node type %T at %v", a.eval, a.pos)
 	}
-	panic()
+	panic("fail")
 }
 
 /*
@@ -210,26 +224,17 @@
 	switch a.t.lit().(type) {
 	case *uintType:
 		vf := v.asUint()
-		a.eval = func(t *Thread) uint64 {
-			v := vf(t)
-			return -v
-		}
+		a.eval = func(t *Thread) uint64 { v := vf(t); return -v }
 	case *intType:
 		vf := v.asInt()
-		a.eval = func(t *Thread) int64 {
-			v := vf(t)
-			return -v
-		}
+		a.eval = func(t *Thread) int64 { v := vf(t); return -v }
 	case *idealIntType:
 		v := v.asIdealInt()()
 		val := v.Neg()
 		a.eval = func() *bignum.Integer { return val }
 	case *floatType:
 		vf := v.asFloat()
-		a.eval = func(t *Thread) float64 {
-			v := vf(t)
-			return -v
-		}
+		a.eval = func(t *Thread) float64 { v := vf(t); return -v }
 	case *idealFloatType:
 		v := v.asIdealFloat()()
 		val := v.Neg()
@@ -243,10 +248,7 @@
 	switch a.t.lit().(type) {
 	case *boolType:
 		vf := v.asBool()
-		a.eval = func(t *Thread) bool {
-			v := vf(t)
-			return !v
-		}
+		a.eval = func(t *Thread) bool { v := vf(t); return !v }
 	default:
 		log.Crashf("unexpected type %v at %v", a.t, a.pos)
 	}
@@ -256,16 +258,10 @@
 	switch a.t.lit().(type) {
 	case *uintType:
 		vf := v.asUint()
-		a.eval = func(t *Thread) uint64 {
-			v := vf(t)
-			return ^v
-		}
+		a.eval = func(t *Thread) uint64 { v := vf(t); return ^v }
 	case *intType:
 		vf := v.asInt()
-		a.eval = func(t *Thread) int64 {
-			v := vf(t)
-			return ^v
-		}
+		a.eval = func(t *Thread) int64 { v := vf(t); return ^v }
 	case *idealIntType:
 		v := v.asIdealInt()()
 		val := v.Neg().Sub(bignum.Int(1))
@@ -1905,5 +1901,5 @@
 	default:
 		log.Crashf("unexpected left operand type %v at %v", lt, r.pos)
 	}
-	panic()
+	panic("fail")
 }
diff --git a/src/pkg/exp/eval/gen.go b/src/pkg/exp/eval/gen.go
index ea421ff..969d655 100644
--- a/src/pkg/exp/eval/gen.go
+++ b/src/pkg/exp/eval/gen.go
@@ -103,12 +103,12 @@
 	Op{Name: "Sub", Expr: "l - r", ConstExpr: "l.Sub(r)", Types: numbers},
 	Op{Name: "Mul", Expr: "l * r", ConstExpr: "l.Mul(r)", Types: numbers},
 	Op{Name: "Quo",
-		Body:      "if r == 0 { t.Abort(DivByZeroError{}) } ret =  l / r",
+		Body:      "if r == 0 { t.Abort(DivByZeroError{}) }; ret =  l / r",
 		ConstExpr: "l.Quo(r)",
 		Types:     numbers,
 	},
 	Op{Name: "Rem",
-		Body:      "if r == 0 { t.Abort(DivByZeroError{}) } ret = l % r",
+		Body:      "if r == 0 { t.Abort(DivByZeroError{}) }; ret = l % r",
 		ConstExpr: "l.Rem(r)",
 		Types:     integers,
 	},
@@ -186,7 +186,7 @@
 	default:
 		log.Crashf("unexpected expression node type %T at %v", a.eval, a.pos);
 	}
-	panic();
+	panic("fail");
 }
 
 /*
@@ -357,7 +357,7 @@
 	default:
 		log.Crashf("unexpected left operand type %v at %v", lt, r.pos);
 	}
-	panic();
+	panic("fail");
 }
 `
 
diff --git a/src/pkg/exp/eval/type.go b/src/pkg/exp/eval/type.go
index 2b2a632..fbb4286 100644
--- a/src/pkg/exp/eval/type.go
+++ b/src/pkg/exp/eval/type.go
@@ -231,7 +231,7 @@
 		res := uint64V(0)
 		return &res
 	}
-	panic("unexpected uint bit count: ", t.Bits)
+	panic("unexpected uint bit count")
 }
 
 func (t *uintType) minVal() *bignum.Rational { return bignum.Rat(0, 1) }
@@ -304,7 +304,7 @@
 		res := intV(0)
 		return &res
 	}
-	panic("unexpected int bit count: ", t.Bits)
+	panic("unexpected int bit count")
 }
 
 func (t *intType) minVal() *bignum.Rational {
@@ -390,7 +390,7 @@
 		res := floatV(0)
 		return &res
 	}
-	panic("unexpected float bit count: ", t.Bits)
+	panic("unexpected float bit count")
 }
 
 var maxFloat32Val = bignum.MakeRat(bignum.Int(0xffffff).Shl(127-23), bignum.Nat(1))
@@ -410,7 +410,7 @@
 		return minFloat64Val
 	}
 	log.Crashf("unexpected floating point bit count: %d", bits)
-	panic()
+	panic("unreachable")
 }
 
 func (t *floatType) maxVal() *bignum.Rational {
@@ -425,7 +425,7 @@
 		return maxFloat64Val
 	}
 	log.Crashf("unexpected floating point bit count: %d", bits)
-	panic()
+	panic("unreachable")
 }
 
 /*
diff --git a/src/pkg/exp/ogle/rvalue.go b/src/pkg/exp/ogle/rvalue.go
index ba915ed..3d630f9 100644
--- a/src/pkg/exp/ogle/rvalue.go
+++ b/src/pkg/exp/ogle/rvalue.go
@@ -232,7 +232,7 @@
 	case 8:
 		return v.r.p.ToFloat64(bits)
 	}
-	panic("Unexpected float size ", v.size)
+	panic("Unexpected float size")
 }
 
 func (v remoteFloat) Set(t *eval.Thread, x float64) {
@@ -247,7 +247,7 @@
 	case 8:
 		bits = v.r.p.FromFloat64(x)
 	default:
-		panic("Unexpected float size ", v.size)
+		panic("Unexpected float size")
 	}
 	v.r.Set(a, v.size, bits)
 }
diff --git a/src/pkg/exp/ogle/vars.go b/src/pkg/exp/ogle/vars.go
index e6298bc..eed60ac 100644
--- a/src/pkg/exp/ogle/vars.go
+++ b/src/pkg/exp/ogle/vars.go
@@ -63,7 +63,7 @@
 	}
 
 	t.Abort(NotOnStack{v.fn, g})
-	panic()
+	panic("fail")
 }
 
 func (v remoteFramePtr) Set(t *eval.Thread, x eval.Value) {
diff --git a/src/pkg/go/ast/walk.go b/src/pkg/go/ast/walk.go
index 2137dda..6c9837a 100644
--- a/src/pkg/go/ast/walk.go
+++ b/src/pkg/go/ast/walk.go
@@ -316,7 +316,7 @@
 
 	default:
 		fmt.Printf("ast.Walk: unexpected type %T", n)
-		panic()
+		panic("ast.Walk")
 	}
 
 	v.Visit(nil)
diff --git a/src/pkg/go/parser/parser.go b/src/pkg/go/parser/parser.go
index 2002d38..6831a53 100644
--- a/src/pkg/go/parser/parser.go
+++ b/src/pkg/go/parser/parser.go
@@ -1738,8 +1738,7 @@
 		return &ast.ForStmt{pos, s1, p.makeExpr(s2), s3, body}
 	}
 
-	panic() // unreachable
-	return nil
+	panic("unreachable")
 }
 
 
diff --git a/src/pkg/go/printer/printer.go b/src/pkg/go/printer/printer.go
index 5a12c6e..2316a45 100644
--- a/src/pkg/go/printer/printer.go
+++ b/src/pkg/go/printer/printer.go
@@ -107,7 +107,7 @@
 	if debug {
 		fmt.Print(p.pos.String() + ": ")
 		fmt.Println(msg)
-		panic()
+		panic("go/printer")
 	}
 }
 
@@ -791,7 +791,7 @@
 			}
 		default:
 			fmt.Fprintf(os.Stderr, "print: unsupported argument type %T\n", f)
-			panic()
+			panic("go/printer type")
 		}
 		p.pos = next
 
diff --git a/src/pkg/gob/decode.go b/src/pkg/gob/decode.go
index 9dea080..3b14841 100644
--- a/src/pkg/gob/decode.go
+++ b/src/pkg/gob/decode.go
@@ -777,7 +777,7 @@
 	case unsafe.Sizeof(float64(0)):
 		op = decFloat64
 	default:
-		panic("gob: unknown size of float", unsafe.Sizeof(float(0)))
+		panic("gob: unknown size of float")
 	}
 	decOpMap[valueKind(float(0))] = op
 
@@ -791,7 +791,7 @@
 		op = decInt64
 		uop = decUint64
 	default:
-		panic("gob: unknown size of int/uint", unsafe.Sizeof(int(0)))
+		panic("gob: unknown size of int/uint")
 	}
 	decOpMap[valueKind(int(0))] = op
 	decOpMap[valueKind(uint(0))] = uop
@@ -803,7 +803,7 @@
 	case unsafe.Sizeof(uint64(0)):
 		uop = decUint64
 	default:
-		panic("gob: unknown size of uintptr", unsafe.Sizeof(uintptr(0)))
+		panic("gob: unknown size of uintptr")
 	}
 	decOpMap[valueKind(uintptr(0))] = uop
 }
diff --git a/src/pkg/http/lex.go b/src/pkg/http/lex.go
index d25c4e4..93b67e7 100644
--- a/src/pkg/http/lex.go
+++ b/src/pkg/http/lex.go
@@ -10,20 +10,16 @@
 	switch c {
 	case '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t':
 		return true
-	default:
-		return false
 	}
-	panic()
+	return false
 }
 
 func isSpace(c byte) bool {
 	switch c {
 	case ' ', '\t', '\r', '\n':
 		return true
-	default:
-		return false
 	}
-	panic()
+	return false
 }
 
 func isCtl(c byte) bool { return (0 <= c && c <= 31) || c == 127 }
diff --git a/src/pkg/net/fd.go b/src/pkg/net/fd.go
index 5619b9e..28e85be 100644
--- a/src/pkg/net/fd.go
+++ b/src/pkg/net/fd.go
@@ -11,6 +11,7 @@
 	"os"
 	"sync"
 	"syscall"
+	"time"
 )
 
 // Network file descriptor.
@@ -176,12 +177,7 @@
 }
 
 func (s *pollServer) Now() int64 {
-	sec, nsec, err := os.Time()
-	if err != nil {
-		panic("net: os.Time: ", err.String())
-	}
-	nsec += sec * 1e9
-	return nsec
+	return time.Nanoseconds()
 }
 
 func (s *pollServer) CheckDeadlines() {
diff --git a/src/pkg/net/unixsock.go b/src/pkg/net/unixsock.go
index 727b99f..daf71c0 100644
--- a/src/pkg/net/unixsock.go
+++ b/src/pkg/net/unixsock.go
@@ -25,7 +25,7 @@
 	var la, ra syscall.Sockaddr
 	switch mode {
 	default:
-		panic("unixSocket", mode)
+		panic("unixSocket mode " + mode)
 
 	case "dial":
 		if laddr != nil {
diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go
index be786e9..f21c564 100644
--- a/src/pkg/reflect/value.go
+++ b/src/pkg/reflect/value.go
@@ -571,7 +571,7 @@
 	typ := v.typ.(*ArrayType).Elem()
 	n := v.Len()
 	if i < 0 || i >= n {
-		panic("index", i, "in array len", n)
+		panic("array index out of bounds")
 	}
 	p := addr(uintptr(v.addr()) + uintptr(i)*typ.Size())
 	return newValue(typ, p, v.canSet)
@@ -642,7 +642,7 @@
 func (v *SliceValue) Slice(beg, end int) *SliceValue {
 	cap := v.Cap()
 	if beg < 0 || end < beg || end > cap {
-		panic("slice bounds [", beg, ":", end, "] with capacity ", cap)
+		panic("slice index out of bounds")
 	}
 	typ := v.typ.(*SliceType)
 	s := new(SliceHeader)
diff --git a/src/pkg/strconv/ftoa_test.go b/src/pkg/strconv/ftoa_test.go
index 70497bf..3771c40 100644
--- a/src/pkg/strconv/ftoa_test.go
+++ b/src/pkg/strconv/ftoa_test.go
@@ -101,7 +101,8 @@
 
 func TestFtoa(t *testing.T) {
 	if FloatSize != 32 {
-		panic("floatsize: ", FloatSize)
+		println("floatsize: ", FloatSize)
+		panic("floatsize")
 	}
 	for i := 0; i < len(ftoatests); i++ {
 		test := &ftoatests[i]
diff --git a/src/pkg/template/template.go b/src/pkg/template/template.go
index e2f70c1..54c22ba 100644
--- a/src/pkg/template/template.go
+++ b/src/pkg/template/template.go
@@ -983,7 +983,7 @@
 func MustParse(s string, fmap FormatterMap) *Template {
 	t, err := Parse(s, fmap)
 	if err != nil {
-		panic("template parse error: ", err.String())
+		panic("template.MustParse error: " + err.String())
 	}
 	return t
 }
@@ -993,7 +993,7 @@
 func MustParseFile(filename string, fmap FormatterMap) *Template {
 	b, err := ioutil.ReadFile(filename)
 	if err != nil {
-		panic("template parse error: ", err.String())
+		panic("template.MustParseFile error: " + err.String())
 	}
 	return MustParse(string(b), fmap)
 }
diff --git a/src/pkg/time/time.go b/src/pkg/time/time.go
index d84807e..7b78874 100644
--- a/src/pkg/time/time.go
+++ b/src/pkg/time/time.go
@@ -15,7 +15,7 @@
 func Seconds() int64 {
 	sec, _, err := os.Time()
 	if err != nil {
-		panic("time: os.Time: ", err.String())
+		panic(err)
 	}
 	return sec
 }
@@ -25,7 +25,7 @@
 func Nanoseconds() int64 {
 	sec, nsec, err := os.Time()
 	if err != nil {
-		panic("time: os.Time: ", err.String())
+		panic(err)
 	}
 	return sec*1e9 + nsec
 }
diff --git a/src/pkg/websocket/server.go b/src/pkg/websocket/server.go
index 78c4299..cc1ff93 100644
--- a/src/pkg/websocket/server.go
+++ b/src/pkg/websocket/server.go
@@ -62,7 +62,7 @@
 func (f Handler) ServeHTTP(c *http.Conn, req *http.Request) {
 	rwc, buf, err := c.Hijack()
 	if err != nil {
-		panic("Hijack failed: ", err.String())
+		panic("Hijack failed: " + err.String())
 		return
 	}
 	// The server should abort the WebSocket connection if it finds
@@ -200,7 +200,7 @@
 
 	rwc, buf, err := c.Hijack()
 	if err != nil {
-		panic("Hijack failed: ", err.String())
+		panic("Hijack failed: " + err.String())
 		return
 	}
 	defer rwc.Close()