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

Documentation lies about Println #218

Closed
ShadiestGoat opened this issue Dec 22, 2023 · 0 comments · Fixed by #228
Closed

Documentation lies about Println #218

ShadiestGoat opened this issue Dec 22, 2023 · 0 comments · Fixed by #228

Comments

@ShadiestGoat
Copy link

The documentation for Color.Println says:

Spaces are always added between operands and a newline is appended.

However, this is not the case. The method uses c.wrap around fmt.Sprint, which has the following space separation:

Spaces are added between operands when neither is a string.
Source

Example problem:

color.New(color.FgCyan).Println("Foo", "Bar")

Expected output is "Foo Bar", real output is "FooBar".

klauspost added a commit to klauspost/fatcolor that referenced this issue Apr 8, 2024
`fmt.Println` will add spaces between elements when there is multiple parameters sent.

When wrapping the colors parameters were combined using `fmt.Sprint(a...)` - which does not space out parameters.

Use `fmt.Sprintln` to combine parameters.

Fixes fatih#218
@fatih fatih closed this as completed in #228 Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant