News for hackers. Stuff that matters.
Re:Three Minor Features in Go 1.18 by klodolph on Wednesday December 22, 2021 @03:04PM (#29654319)
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!
Re:Three Minor Features in Go 1.18 by hiptobecubic on Wednesday December 22, 2021 @10:13PM (#29658253)
Copy-pasting and rewriting is the Go Way.
Re:Three Minor Features in Go 1.18 by klodolph on Thursday December 23, 2021 @01:45PM (#29665015)
Hey, I'll take it, over the NPM left-pad way of doing things.
Re:Three Minor Features in Go 1.18 by pjmlp on Thursday December 23, 2021 @02:25AM (#29659522)
You could have written a package, but I guess copy-paste is more in line with Go's culture.
Re:Three Minor Features in Go 1.18 by klodolph on Thursday December 23, 2021 @01:45PM (#29665007)
Using a package is the NPM left-pad way of doing things. This function is like two lines long.
Re:Three Minor Features in Go 1.18 by pjmlp on Friday December 24, 2021 @05:01AM (#29672210)
So? Keep it for yourself on an utilities package.

I said nothing of using one package per function.

Re:Three Minor Features in Go 1.18 by klodolph on Friday December 24, 2021 @09:37PM (#29679839)
I 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.