Nice video. I have a one nit here though to raise in 100 go mistakes there is a section about embedding saying the following: > What can we say about type embedding? First, let’s note that it’s rarely a necessity, > and it means that whatever the use case, we can probably solve it as well without type embedding. > Type embedding is mainly used for convenience: in most cases, to promote behaviors. and then it also says > Using type embedding consciously by keeping these constraints in mind can help avoid > boilerplate code with additional forwarding methods. However, let’s make sure we don’t do it > solely for cosmetics and not promote elements that should remain hidden given the above, what would you do differently? (I still haven't decided which is better yet tbh) Another question I have is I see you using `database.GetGuestFeatures()` which makes me believe you have a function `GetGuestFeatures()` under a `database` package. My question is how would you unit test HasFeature function here?
The book gives an example where embeddings work well, ie where you want to avoid method forwarding, which is the case for us here. As for testing, you can mock out the database, see: github.com/stretchr/testify
This is so elegant. Can’t wait to see more go content in this channel
Thank you!
More premium go contents please.
Nice video. I have a one nit here though to raise
in 100 go mistakes there is a section about embedding saying the following:
> What can we say about type embedding? First, let’s note that it’s rarely a necessity,
> and it means that whatever the use case, we can probably solve it as well without type embedding.
> Type embedding is mainly used for convenience: in most cases, to promote behaviors.
and then it also says
> Using type embedding consciously by keeping these constraints in mind can help avoid
> boilerplate code with additional forwarding methods. However, let’s make sure we don’t do it
> solely for cosmetics and not promote elements that should remain hidden
given the above, what would you do differently? (I still haven't decided which is better yet tbh)
Another question I have is I see you using `database.GetGuestFeatures()` which makes me believe you have a function `GetGuestFeatures()` under a `database` package. My question is how would you unit test HasFeature function here?
The book gives an example where embeddings work well, ie where you want to avoid method forwarding, which is the case for us here.
As for testing, you can mock out the database, see: github.com/stretchr/testify
Good work Mux. Which Vs code theme is close to what you're using
great example! Thanks for sharing
Thank you so much for the content! What app do you use for code animations?
I edit in Final Cut Pro and got a script I wrote for Neovim to type out the code.
@@mr_mux408 Thank you so much, animation looks cool!
Can you share the github code for this ?
Great