4 ms·
I’ve been copy-pasting or re-writing a function much like strings.Cut, probably dozens of times, in different Go packages. It’s nice to see this function make i
by klodolph 5y ago
I’ve been copy-pasting or re-writing a function much like strings.Cut, probably dozens of times, in different Go packages. It’s nice to see this function make it into the standard library!
- deleted 5y ago[deleted]
- hiptobecubic 5y agoCopy-pasting and rewriting is the Go Way.
- klodolph 5y agoHey, I'll take it, over the NPM left-pad way of doing things.
- pjmlp 5y agoYou could have written a package, but I guess copy-paste is more in line with Go's culture.
- klodolph 5y agoUsing a package is the NPM left-pad way of doing things. This function is like two lines long.
- pjmlp 5y agoSo? Keep it for yourself on an utilities package. I said nothing of using one package per function.
- klodolph 5y agoI used to do that. I had a "goutils" package or something like that. From use, I concluded that the utilities package contained only two things: functionality that was substantial enough to clean up and publish as its own package on GitHub, and minor functionality that was better off being copy/pasted between projects. So I abandoned my utility package and published a few minor packages on GitHub.