Commit fba7b04d authored by Rob Pike's avatar Rob Pike

fmt: clean up some errors found by vet

Includes deleting some unused items.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12305043
parent e03dd079
...@@ -906,7 +906,7 @@ type Recur struct { ...@@ -906,7 +906,7 @@ type Recur struct {
failed *bool failed *bool
} }
func (r Recur) String() string { func (r *Recur) String() string {
if recurCount++; recurCount > 10 { if recurCount++; recurCount > 10 {
*r.failed = true *r.failed = true
return "FAIL" return "FAIL"
...@@ -919,13 +919,13 @@ func (r Recur) String() string { ...@@ -919,13 +919,13 @@ func (r Recur) String() string {
func TestBadVerbRecursion(t *testing.T) { func TestBadVerbRecursion(t *testing.T) {
failed := false failed := false
r := Recur{3, &failed} r := &Recur{3, &failed}
Sprintf("recur@%p value: %d\n", &r, r.i) Sprintf("recur@%p value: %d\n", &r, r.i)
if failed { if failed {
t.Error("fail with pointer") t.Error("fail with pointer")
} }
failed = false failed = false
r = Recur{4, &failed} r = &Recur{4, &failed}
Sprintf("recur@%p, value: %d\n", r, r.i) Sprintf("recur@%p, value: %d\n", r, r.i)
if failed { if failed {
t.Error("fail with value") t.Error("fail with value")
......
...@@ -24,8 +24,6 @@ const ( ...@@ -24,8 +24,6 @@ const (
var padZeroBytes = make([]byte, nByte) var padZeroBytes = make([]byte, nByte)
var padSpaceBytes = make([]byte, nByte) var padSpaceBytes = make([]byte, nByte)
var newline = []byte{'\n'}
func init() { func init() {
for i := 0; i < nByte; i++ { for i := 0; i < nByte; i++ {
padZeroBytes[i] = '0' padZeroBytes[i] = '0'
......
...@@ -641,8 +641,6 @@ func (p *pp) fmtPointer(value reflect.Value, verb rune, goSyntax bool) { ...@@ -641,8 +641,6 @@ func (p *pp) fmtPointer(value reflect.Value, verb rune, goSyntax bool) {
var ( var (
intBits = reflect.TypeOf(0).Bits() intBits = reflect.TypeOf(0).Bits()
floatBits = reflect.TypeOf(0.0).Bits()
complexBits = reflect.TypeOf(1i).Bits()
uintptrBits = reflect.TypeOf(uintptr(0)).Bits() uintptrBits = reflect.TypeOf(uintptr(0)).Bits()
) )
......
...@@ -479,11 +479,6 @@ func (s *ss) token(skipSpace bool, f func(rune) bool) []byte { ...@@ -479,11 +479,6 @@ func (s *ss) token(skipSpace bool, f func(rune) bool) []byte {
return s.buf return s.buf
} }
// typeError indicates that the type of the operand did not match the format
func (s *ss) typeError(arg interface{}, expected string) {
s.errorString("expected argument of type pointer to " + expected + "; found " + reflect.TypeOf(arg).String())
}
var complexError = errors.New("syntax error scanning complex number") var complexError = errors.New("syntax error scanning complex number")
var boolError = errors.New("syntax error scanning boolean") var boolError = errors.New("syntax error scanning boolean")
......
...@@ -54,7 +54,6 @@ var ( ...@@ -54,7 +54,6 @@ var (
float32Val float32 float32Val float32
float64Val float64 float64Val float64
stringVal string stringVal string
stringVal1 string
bytesVal []byte bytesVal []byte
runeVal rune runeVal rune
complex64Val complex64 complex64Val complex64
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment