Skip to content

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.

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