Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: the "alternate form" (the # flag) for floating point is not supported #18857
What version of Go are you using (
Amazingly, this specification was part of ANSI C89, yet I had no memory of it and neither do several other people I asked.
I would like to say that although fmt.Printf was certainly inspired by and influenced by C's printf, there is no guarantee to maintain compatibility between the two. The two libraries agree only partially and only in the handling of basic types. They diverge wildly beyond that.
That said, the feature request seems reasonable, particularly the request for a guaranteed decimal point, somewhat analogous to the # flag for %x. I therefore suggest we add this behavior. I suspect it's safe to do so as it's unlikely anyone is using %#g except in the expectation that this property will be maintained.
I stress again, though, that the issue deserves attention because it's a good idea, not because C does it this way.