3 ms·
> I don't think there's been a single instance where I've thought "why can't stdlib do this?" I've had this a few times, most recently with "how do I add this
by laverya 6y ago
> I don't think there's been a single instance where I've thought "why can't stdlib do this?"
I've had this a few times, most recently with "how do I add this data file to my binary". At least that one made it to master now, and will be in 1.16!
Another gripe is the lack of a proper parallel safe map (no, map[interface{}]interface{} like sync.Map is just not acceptable) which would be a godsend and should honestly just be the normal map implementation. Maybe eventually with generics... (This is more of a language gripe than a stdlib gripe, though, and I'm sure that once generics come out we'll see a sync.Map that doesn't use interface {})
- swirepe 6y ago>I've had this a few times, most recently with "how do I add this data file to my binary". At least that one made it to master now, and will be in 1.16! Wait, how?? I've done some unholy things.
- deleted 6y ago[deleted]
- laverya 6y agoThe best example for the new '//go:embed' directive I've seen so far is this: package main import ( "embed" "net/http" ) //go:embed assets/* var assets embed.FS func main() { fs := http.FileServer(http.FS(assets)) http.ListenAndServe(":8080", fs) } For the next month, the list of options here [0] will have to suffice. 0: https://go.googlesource.com/proposal/+/master/design/draft-embed.md#background https://go.googlesource.com/proposal/+/master/design/draft-e...
- rad_gruchalski 6y ago> I've had this a few times, most recently with "how do I add this data file to my binary". At least that one made it to master now, and will be in 1.16! And before 1.16, there is statik: https://github.com/rakyll/statik https://github.com/rakyll/statik. Creates an embeddable file system from files or directories. It’s awesome for packaging web front ends into binaries.
- anderspitman 6y agoHow does statik compare to rice, which is what I had assumed everyone was using: https://github.com/GeertJohan/go.rice https://github.com/GeertJohan/go.rice
- laverya 6y agoBefore 1.16, there's a whole list [0], though I've personally used go-bindata the most. I've yet to try statik, though I doubt I'll ever have a reason to now! 0: https://go.googlesource.com/proposal/+/master/design/draft-embed.md#background https://go.googlesource.com/proposal/+/master/design/draft-e...
- anderspitman 6y ago> I've had this a few times, most recently with "how do I add this data file to my binary" Ok fair enough, that one bit me too, but honestly I only felt cheated because Rust makes it so easy. `include_bytes!` was like cheating the first time I used it.
- erichanson 6y agoThis is so frickin' cool.