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: Printf, %s output of nil get poisoned by struct pointers #3752

Closed
gopherbot opened this issue Jun 18, 2012 · 3 comments
Closed

fmt: Printf, %s output of nil get poisoned by struct pointers #3752

gopherbot opened this issue Jun 18, 2012 · 3 comments
Assignees

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 18, 2012

by jakzale:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Print nil using %s placeholder after printing a structure  or a pointer using %s
placeholder
2. http://play.golang.org/p/0XwuksmHud

What is the expected output?
%!s(<nil>) %!s(*main.A=<nil>) %!s(<nil>) {} %!s(<nil>)

What do you see instead?
%!s(<nil>) %!s(*main.A=<nil>) %!s(*main.A=<nil>) {} %!s(main.B={})

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OSX 10.7.4

Which version are you using?  (run 'go version')
go version go1.0.2

Please provide any additional information below.
@robpike
Copy link
Contributor

@robpike robpike commented Jun 18, 2012

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Owner changed to @robpike.

Status changed to Accepted.

@rsc
Copy link
Contributor

@rsc rsc commented Jun 18, 2012

Comment 2:

Ouch.
@robpike
Copy link
Contributor

@robpike robpike commented Jun 25, 2012

Comment 3:

This issue was closed by revision a308be5.

Status changed to Fixed.

robpike added a commit that referenced this issue May 11, 2015
««« backport 5f13e0662e38
fmt: set p.field before nil check
Fixes #3752.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6331062

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.