Hacker News new | past | comments | ask | show | jobs | submit login

People who say "he could just use sprintf" are missing the point: this lets you use sprintf while writing idiomatic Go.

If I see a Go programmer import a sprintf library just because he doesn't want to conform to the programming environment, that's going to ruffle some feathers during code review.

But if he uses this, well, I'd be none the wiser.

Readability counts.




> Readability counts.

Oh yeah: `01200602150405`


Look, I'm not trying to make an argument for how good or bad Go's string formatting is. Tbh I forget both and I find myself back in the documentation either way.

But in this case, you're programming Go already. Better stick with the tools that everyone knows and expects. In .go files, Go code is more readable. In .py, it's not.

People who read your Go code will know Go, and they will be in "Go mode". To them a Go-style date formatting string will make more sense than a sprintf one.


Why would you pack it like that with no delimiters? If you want something with only digits then use seconds since epoch.


Looks like `mmyyyyddhhmmss`? (I've never seen month-year-day before, that's threw me for a second.)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: