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: %#x on string prints 0x for every byte #8080

Closed
rsc opened this issue May 22, 2014 · 3 comments
Closed

fmt: %#x on string prints 0x for every byte #8080

rsc opened this issue May 22, 2014 · 3 comments
Assignees
Milestone

Comments

@rsc
Copy link
Contributor

@rsc rsc commented May 22, 2014

http://play.golang.org/p/Qmvs0J1cpM 

package main
import "fmt"
func main() {
    fmt.Printf("%x\n", "hello")
    fmt.Printf("%#x\n", "hello")
}

prints

68656c6c6f
0x680x650x6c0x6c0x6f

It should probably print

68656c6c6f
0x68656c6c6f

Too late for 1.3; something to think about for 1.4.
@robpike
Copy link
Contributor

@robpike robpike commented May 22, 2014

Comment 1:

Owner changed to @robpike.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 11, 2014

Comment 2:

CL https://golang.org/cl/106990043 mentions this issue.
@robpike
Copy link
Contributor

@robpike robpike commented Jun 16, 2014

Comment 3:

This issue was closed by revision 311e286.

Status changed to Fixed.

@rsc rsc added fixed labels Jun 16, 2014
@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Printf("%x", "abc") was "0x610x620x63"; is now "0x616263", which
is surely better.
Printf("% #x", "abc") is still "0x61 0x62 0x63".

Fixes golang#8080.

LGTM=bradfitz, gri
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/106990043
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.