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

'+' or ' ' flag in Printf (et al) doesn't seem to work for positive or zero values #278

Closed
gopherbot opened this issue Nov 20, 2009 · 3 comments

Comments

@gopherbot
Copy link
Contributor

by mkoistinen:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Run this code:
--- snip snip ---
package main
import . "fmt"

func main() {
    Printf("Test of Printf() string '+.3e': [%+.3e] [%+.3e] [%+.3e]\n", 0.0,
-1.5, 10000.5);
}
--- snip snip ---

Output should be: 
Test of Printf() string '+.3e': [0.000e+00] [-1.500e+00] [1.000e+04]

2. Notice the lack of the '+' sign in front of the returned 1st and 3rd values

3. Compare to specification in `man printf` on your system

What is the expected output? What do you see instead?
The output SHOULD be: 
... [+0.000e+00] [-1.500e+00] [+1.000e+04]

Also, same for the ' ' flag, which should put a space before positive
numbers instead of the '+' symbol above.

What is your $GOOS?  $GOARCH?
GOARCH=amd64
GOOS=darwin


Which revision are you using?  (hg identify)
> hg identify
cb140bac9ab0 tip

Please provide any additional information below.

Sorry if this has already been fixed since this version, but I am working
on code for another system, and must maintain the same version locally as
the remote system.
@griesemer
Copy link
Contributor

Comment 1:

Owner changed to r...@golang.org.

@robpike
Copy link
Contributor

robpike commented Nov 20, 2009

Comment 2:

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Nov 20, 2009

Comment 3:

This issue was closed by revision 542e5b8.

Status changed to Fixed.

Merged into issue #-.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
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