diff options
author | Rob Pike <r@golang.org> | 2014-10-01 21:35:12 +0000 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2014-10-01 21:35:12 +0000 |
commit | 843bbf32df3423ca8ab59490f46412e48a36cabf (patch) | |
tree | 83f160eeaf316a829f8353ac0590659d98d85c17 | |
parent | 4cdb5665c71cab400c38adcaf3297418cabf44d9 (diff) | |
download | go-843bbf32df3423ca8ab59490f46412e48a36cabf.tar.gz |
fmt: fix internal unknownType function
This thing should never be called, but before
151960044 it was being called, incorrectly.
This is now just a precaution but let's pretend it
Fixes issue 8843
even though that was fixed by 151960044.
The test case was already there and ran, another mystery.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/151970043
-rw-r--r-- | src/fmt/print.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fmt/print.go b/src/fmt/print.go index 679c577db..de69e90fb 100644 --- a/src/fmt/print.go +++ b/src/fmt/print.go @@ -297,13 +297,13 @@ func parsenum(s string, start, end int) (num int, isnum bool, newi int) { return } -func (p *pp) unknownType(v interface{}) { - if v == nil { +func (p *pp) unknownType(v reflect.Value) { + if !v.IsValid() { p.buf.Write(nilAngleBytes) return } p.buf.WriteByte('?') - p.buf.WriteString(reflect.TypeOf(v).String()) + p.buf.WriteString(v.Type().String()) p.buf.WriteByte('?') } |