Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1331f8b3
Commit
1331f8b3
authored
Apr 28, 2010
by
Christopher Wedgwood
Committed by
Rob Pike
Apr 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt: %T print <nil> for nil
R=r CC=golang-dev, rsc
https://golang.org/cl/1014043
parent
96179629
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
fmt_test.go
src/pkg/fmt/fmt_test.go
+1
-0
print.go
src/pkg/fmt/print.go
+4
-0
No files found.
src/pkg/fmt/fmt_test.go
View file @
1331f8b3
...
...
@@ -264,6 +264,7 @@ var fmttests = []fmtTest{
fmtTest
{
"%d"
,
"hello"
,
"%d(string=hello)"
},
fmtTest
{
"no args"
,
"hello"
,
"no args?(extra string=hello)"
},
fmtTest
{
"%s"
,
nil
,
"%s(<nil>)"
},
fmtTest
{
"%T"
,
nil
,
"<nil>"
},
}
func
TestSprintf
(
t
*
testing
.
T
)
{
...
...
src/pkg/fmt/print.go
View file @
1331f8b3
...
...
@@ -1030,6 +1030,10 @@ func (p *pp) doprintf(format string, a []interface{}) {
// the value's type
case
'T'
:
if
field
==
nil
{
p
.
buf
.
Write
(
nilAngleBytes
)
break
}
p
.
buf
.
WriteString
(
reflect
.
Typeof
(
field
)
.
String
())
default
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment