Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: define what %p means (or doesn't mean) on interfaces #16314

Closed
bradfitz opened this issue Jul 10, 2016 · 2 comments
Closed

fmt: define what %p means (or doesn't mean) on interfaces #16314

bradfitz opened this issue Jul 10, 2016 · 2 comments

Comments

@bradfitz
Copy link
Contributor

(split from #16230 (comment))

What does %p mean in the fmt package for interface values?

It seems to do something, but the documentation says nothing.

/cc @josharian @robpike

@bradfitz bradfitz added this to the Go1.8 milestone Jul 10, 2016
@josharian
Copy link
Contributor

It's well-defined. The fmt package docs say: "Regardless of the verb, if an operand is an interface value, the internal concrete value is used, not the interface itself." This is a bug in vet, and I already have a fix in my tree for it as part of fixing #11041.

josharian added a commit to josharian/go that referenced this issue Jul 13, 2016
fmt treats interfaces as being transparent.
As a result, we cannot say with confidence
that any particular verb is wrong.

This fixes the following vet false positives
in the standard library:

database/sql/sql_test.go:210: arg dep for printf verb %p of wrong type: sql.finalCloser
fmt/fmt_test.go:1663: arg nil for printf verb %s of wrong type: untyped nil
go/ast/commentmap.go:328: arg node for printf verb %p of wrong type: ast.Node
net/http/transport_test.go:120: arg c for printf verb %p of wrong type: net.Conn
net/http/httptest/server.go:198: arg c for printf verb %p of wrong type: net.Conn
net/http/httputil/dump_test.go:258: arg body for printf verb %p of wrong type: io.Reader
reflect/set_test.go:81: arg x for printf verb %p of wrong type: io.Writer
reflect/set_test.go:141: arg bb for printf verb %p of wrong type: io.Reader

Updates golang#11041
Updates golang#16314

Change-Id: I76df01abb3c34a97b6960f551bed9c1c91377cfc
josharian added a commit to josharian/go that referenced this issue Jul 14, 2016
fmt treats interfaces as being transparent.
As a result, we cannot say with confidence
that any particular verb is wrong.

This fixes the following vet false positives
in the standard library:

database/sql/sql_test.go:210: arg dep for printf verb %p of wrong type: sql.finalCloser
fmt/fmt_test.go:1663: arg nil for printf verb %s of wrong type: untyped nil
go/ast/commentmap.go:328: arg node for printf verb %p of wrong type: ast.Node
net/http/transport_test.go:120: arg c for printf verb %p of wrong type: net.Conn
net/http/httptest/server.go:198: arg c for printf verb %p of wrong type: net.Conn
net/http/httputil/dump_test.go:258: arg body for printf verb %p of wrong type: io.Reader
reflect/set_test.go:81: arg x for printf verb %p of wrong type: io.Writer
reflect/set_test.go:141: arg bb for printf verb %p of wrong type: io.Reader

Updates golang#11041
Updates golang#16314

Change-Id: I76df01abb3c34a97b6960f551bed9c1c91377cfc
josharian added a commit to josharian/go that referenced this issue Jul 21, 2016
fmt treats interfaces as being transparent.
As a result, we cannot say with confidence
that any particular verb is wrong.

This fixes the following vet false positives
in the standard library:

database/sql/sql_test.go:210: arg dep for printf verb %p of wrong type: sql.finalCloser
fmt/fmt_test.go:1663: arg nil for printf verb %s of wrong type: untyped nil
go/ast/commentmap.go:328: arg node for printf verb %p of wrong type: ast.Node
net/http/transport_test.go:120: arg c for printf verb %p of wrong type: net.Conn
net/http/httptest/server.go:198: arg c for printf verb %p of wrong type: net.Conn
net/http/httputil/dump_test.go:258: arg body for printf verb %p of wrong type: io.Reader
reflect/set_test.go:81: arg x for printf verb %p of wrong type: io.Writer
reflect/set_test.go:141: arg bb for printf verb %p of wrong type: io.Reader

Updates golang#11041
Updates golang#16314

Change-Id: I76df01abb3c34a97b6960f551bed9c1c91377cfc
@gopherbot
Copy link

CL https://golang.org/cl/27127 mentions this issue.

gopherbot pushed a commit that referenced this issue Aug 18, 2016
fmt treats interfaces as being transparent.
As a result, we cannot say with confidence
that any particular verb is wrong.

This fixes the following vet false positives
in the standard library:

database/sql/sql_test.go:210: arg dep for printf verb %p of wrong type: sql.finalCloser
fmt/fmt_test.go:1663: arg nil for printf verb %s of wrong type: untyped nil
go/ast/commentmap.go:328: arg node for printf verb %p of wrong type: ast.Node
net/http/transport_test.go:120: arg c for printf verb %p of wrong type: net.Conn
net/http/httptest/server.go:198: arg c for printf verb %p of wrong type: net.Conn
net/http/httputil/dump_test.go:258: arg body for printf verb %p of wrong type: io.Reader
reflect/set_test.go:81: arg x for printf verb %p of wrong type: io.Writer
reflect/set_test.go:141: arg bb for printf verb %p of wrong type: io.Reader

Updates #11041
Updates #16314

Change-Id: I76df01abb3c34a97b6960f551bed9c1c91377cfc
Reviewed-on: https://go-review.googlesource.com/27127
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
@golang golang locked and limited conversation to collaborators Aug 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants