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

Fix invalid sprintf #152

Merged
merged 1 commit into from
Dec 15, 2021
Merged

Fix invalid sprintf #152

merged 1 commit into from
Dec 15, 2021

Conversation

howardjohn
Copy link
Contributor

@howardjohn howardjohn commented Dec 9, 2021

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
Copy link
Owner

evanphx commented Dec 15, 2021

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

@howardjohn
Copy link
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
Copy link
Owner

evanphx commented Dec 15, 2021

Oh I'm sorry, I misread this entirely.

@evanphx evanphx merged commit 6a7ad8a into evanphx:master Dec 15, 2021
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.

None yet

2 participants