Skip to content

Commit

Permalink
typecheck: fix test failure due to go vet
Browse files Browse the repository at this point in the history
  • Loading branch information
fhs committed Jun 27, 2019
1 parent 66ad58e commit d8cafc1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions typecheck/typecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (c *Checker) stmt(s stmt.Stmt, retType *tipe.Tuple, retNames []string) tipe
}
cht, ok := p.typ.(*tipe.Chan)
if !ok {
c.errorfmt("cannot send to non-channel type: %s", cht)
c.errorfmt("cannot send to non-channel type: %v", cht)
return nil
}
p = c.expr(s.Value)
Expand All @@ -548,7 +548,7 @@ func (c *Checker) stmt(s stmt.Stmt, retType *tipe.Tuple, retNames []string) tipe
}
c.convert(&p, cht.Elem)
if p.mode == modeInvalid {
c.errorfmt("cannot send %s to %s", p.typ, cht)
c.errorfmt("cannot send %s to %v", p.typ, cht)
}
return nil

Expand Down Expand Up @@ -1555,7 +1555,7 @@ func (c *Checker) exprBuiltinCall(e *expr.Call) partial {
}
if ch.Direction == tipe.ChanRecv {
p.mode = modeInvalid
c.errorfmt("%s: cannot close receive-only channel", e)
c.errorfmt("%v: cannot close receive-only channel", e)
return p
}
return p
Expand Down Expand Up @@ -1930,12 +1930,12 @@ func (c *Checker) exprPartialCall(e *expr.Call) partial {
if e.Ellipsis {
if !funct.Variadic {
p.mode = modeInvalid
c.errorfmt("cannot use ... with non-variadic function %s", funct)
c.errorfmt("cannot use ... with non-variadic function %v", funct)
return p
}
if len(e.Args) == 1 && len(unpacked) > 1 {
p.mode = modeInvalid
c.errorfmt("cannot use ... with multi-valued function %s", funct)
c.errorfmt("cannot use ... with multi-valued function %v", funct)
return p
}
}
Expand All @@ -1958,7 +1958,7 @@ func (c *Checker) exprPartialCall(e *expr.Call) partial {
continue
}
p.mode = modeInvalid
c.errorfmt("too many arguments to function %s", funct)
c.errorfmt("too many arguments to function %v", funct)
return p
}

Expand Down Expand Up @@ -2022,7 +2022,7 @@ func (c *Checker) exprPartialCall(e *expr.Call) partial {
}
if numArgs < len(params) {
p.mode = modeInvalid
c.errorfmt("too few arguments in call to %s", funct)
c.errorfmt("too few arguments in call to %v", funct)
return p
}

Expand Down Expand Up @@ -2206,7 +2206,7 @@ func (c *Checker) exprPartial(e expr.Expr, hint typeHint) (p partial) {
if t, resolved := c.resolve(e.Type); resolved {
t, isArray := t.(*tipe.Array)
if !isArray {
c.errorfmt("type %s is not an array", t)
c.errorfmt("type %v is not an array", t)
p.mode = modeInvalid
return p
}
Expand Down Expand Up @@ -2596,7 +2596,7 @@ func (c *Checker) exprPartial(e expr.Expr, hint typeHint) (p partial) {
}
}
p.mode = modeInvalid
c.errorfmt("%s undefined (type %s has no field or method %s)", e, typ, right)
c.errorfmt("%v undefined (type %v has no field or method %s)", e, typ, right)
}
}
switch lt := lt.(type) {
Expand All @@ -2620,11 +2620,11 @@ func (c *Checker) exprPartial(e expr.Expr, hint typeHint) (p partial) {
}
}
p.mode = modeInvalid
c.errorfmt("%s not in package %s", e, lt)
c.errorfmt("%v not in package %s", e, lt)
return p
}
p.mode = modeInvalid
c.errorfmt("%s undefined (type %s is not a struct or package)", e, left.typ)
c.errorfmt("%v undefined (type %s is not a struct or package)", e, left.typ)
return p
case *expr.Index:
left := c.expr(e.Left)
Expand Down Expand Up @@ -2737,7 +2737,7 @@ func (c *Checker) exprPartial(e expr.Expr, hint typeHint) (p partial) {
atTyp.Params.Elems[0] != tipe.Int || (dim == 2 && atTyp.Params.Elems[1] != tipe.Int) ||
len(atTyp.Results.Elems) != 1 {
p.mode = modeInvalid
c.errorfmt("cannot slice type %s, expecting method %s but type has %s", left.typ, want, atTyp)
c.errorfmt("cannot slice type %s, expecting method %s but type has %v", left.typ, want, atTyp)
return p
}
p.mode = modeVar
Expand Down

0 comments on commit d8cafc1

Please sign in to comment.