1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:37:58 -07:00

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
This commit is contained in:
Rob Pike 2013-08-02 11:38:19 +10:00
parent e03dd07981
commit fba7b04dcb
5 changed files with 3 additions and 13 deletions

View File

@ -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 {
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")

View File

@ -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'

View File

@ -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()
) )

View File

@ -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")

View File

@ -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