Re:A Mini-Guide to Google Golang and Why It's Perfect for De...
by mbarlocker on Wednesday April 19, 2017 @05:45PM
(#14152078)
the thing i hate most about golang: no generics.
the thing i love most about golang: super fast.
Just yesterday, I discovered their date parsing, which uses example based formats. It's pretty cool. Instead of the typical yyyy-mm-dd format nightmare, you would do 2006-01-02. The reference date is the key.
Re:A Mini-Guide to Google Golang and Why It's Perfect for De...
by christophberger on Thursday April 20, 2017 @02:25AM
(#14154399)
Generics have their use cases, but in general they are overrated. Especially in (but not limited to) the DevOps area, I bet that 99% of the code needs no generics at all.
Re:A Mini-Guide to Google Golang and Why It's Perfect for De...
by BlueMatador on Thursday April 20, 2017 @11:59AM
(#14157858)
You're right. Although a lot of people have written about this limitation in the language. Applied Go has a tutorial on how to use arrays, slices, or maps as a workaround for many generics need cases, much like it looks like Ply does. https://appliedgo.net/generics/
Re:A Mini-Guide to Google Golang and Why It's Perfect for De...
by mbarlocker on Thursday April 20, 2017 @12:04PM
(#14157896)
depends on what you're trying to do with devops. If you're writing a script, I agree. Use bash anyway, Go probably isn't the thing. If you're writing a modular agent that monitors a running system, then generics would be pretty nice.
Ply looks interesting, but still lacking for my particular use case.
Just yesterday, I discovered their date parsing, which uses example based formats. It's pretty cool. Instead of the typical yyyy-mm-dd format nightmare, you would do 2006-01-02. The reference date is the key.
https://golang.org/pkg/time/#pkg-constants
Having said that, I would not complain if the concept of Ply (https://github.com/lukechampine/ply) becomes part of standard Go.
Ply looks interesting, but still lacking for my particular use case.