Last 12 weeks · 0 commits
2 of 6 standards met
For regular text, injecting newlines when wrapping is the obvious (and only reasonable) choice. However, consider a situation where you're wrapping a shell (or ) command: in such a case, you'll want a , followed by a newline. This pull introduces the argument for that reason. Unfortunately, since Go does not support optional arguments or overloading, this breaks the existing API, but I think it's worth it. The alternative would be to introduce an additional method, but, IMHO, this is less sensible, especially since fixing existing code wouldn't be hard or time-consuming.
Repository: mitchellh/go-wordwrap. Description: A Go (golang) library for wrapping words in a string. Stars: 126, Forks: 18. Primary language: Go. Languages: Go (100%). License: MIT. Open PRs: 1, open issues: 0. Last activity: 5y ago. Community health: 42%. Top contributors: mitchellh, lukecyca, bflad, dtolnay.
I noticed that there are no tests for special characters, and that the source does convert the string into a rune slice.