Hmm I'm not sure I agree with all of these. Personally I think it's nicer to split packages by domain, not what they happen to implement (context etc).
I would say it's more important that your package name has semantic meaning. "util" is akin to "interface{}": it says literally nothing. "generate" says "this package contains behaviours for generating things". That being said you could probably put "generateRandomBytes(..)" and "generateRandomString(..)" into package "rand" and "generateCert(..)" into package "cert".
jack mordaunt I doubt he took it as is in Go from someone else. He would have mentioned the person just like Dave Cheney mentioned Rob Pike. It's likely he got inspiration from someone else but that's not always conscious.
7:30 - Tiny Package Syndrome
9:23 - Premature Exportation
12:14 - Package util
13:43 - Config Structs
18:32 - Pointer All The Things
19:44 - context.Value
21:45 - Asynchronous APIs
23:45 - If - Then - Else
26:35 - Panic In a Lib
28:21 - Interface All The Things
32:21 - Naked Return Values
33:38 - interface{}
A tip : watch series on flixzone. Me and my gf have been using it for watching a lot of movies lately.
@Ibrahim Blake Definitely, have been using flixzone for since november myself :)
@Ibrahim Blake yup, been watching on Flixzone for years myself :)
Go Anti Patterns slide at 7:09
Thanks. That's cured me of the "tiny-packages" syndrome.
The aspect ratio of the video doesn't seem right to me...
It's obviously a practical joke, "anti-pattern"
:\
Doesn't It look like an anti-pattern if you named your presentation slide "Anti-pattern:.." and then explain best-practices within it? :)
Where can I get slides?
Hmm I'm not sure I agree with all of these. Personally I think it's nicer to split packages by domain, not what they happen to implement (context etc).
Yeah he says "name packages based on purpose not contents"
Shouldn't the package names be nouns instead of verbs?
I would say it's more important that your package name has semantic meaning. "util" is akin to "interface{}": it says literally nothing. "generate" says "this package contains behaviours for generating things". That being said you could probably put "generateRandomBytes(..)" and "generateRandomString(..)" into package "rand" and "generateCert(..)" into package "cert".
lol. I feel attacked.
The credit for functional options should go to Rob Pike.
Tibor Vass and I'm sure Rob got the idea from somewhere else.
jack mordaunt I doubt he took it as is in Go from someone else. He would have mentioned the person just like Dave Cheney mentioned Rob Pike. It's likely he got inspiration from someone else but that's not always conscious.
Every feel like you just watched a commercial for an employer disguised as a tech talk?
18:00 The type declaration is missing the type name. Presumably, it should read 𝚝𝚢𝚙𝚎 𝙾𝚙𝚝 𝚏𝚞𝚗𝚌(*𝚃𝚑𝚒𝚗𝚐) 𝙾𝚙𝚝