Skip to content

Fix invalid sprintf - #152

Merged
evanphx merged 1 commit into
evanphx:masterfrom
howardjohn:patch-1
Dec 15, 2021
Merged

evanphx merged 1 commit into
evanphx:masterfrom
howardjohn:patch-1

Conversation

@howardjohn

@howardjohn howardjohn commented Dec 9, 2021 •

Copy link
Copy Markdown
Contributor

We are using %s but the input is not a string. This can result in bad error messages, for example https://go.dev/play/p/NoimdDgOdDR

We are using `%s` but the input is not a string. This can result in bad error messages
@evanphx

evanphx commented Dec 15, 2021

Copy link
Copy Markdown
Owner

This is using %v so that the output contains quotes, as that's how fmt handles string inputs.

@howardjohn

Copy link
Copy Markdown
Contributor Author

I posted a link to a go playground example

tl;dr, for a non-string input like 10

before: %!s(int=10)
after: 10

@evanphx

evanphx commented Dec 15, 2021

Copy link
Copy Markdown
Owner

Oh I'm sorry, I misread this entirely.

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 this pull request may close these issues.

2 participants