07 December, 2018

TIL #4 - random tidbits

Notes taken between: 3-7 December 2018


clear cookies in your browser

clear cookies in chrome devtools -> applications - cookies -> select site - > delete it

go tip

Its a small difference but using require.NoError instead of require.Nil for errors results in much nicer test failure messages.

go context

Go has a package named context in its standard library. It’s responsibilities are cancelations and carrying request-scoped data (but that doesn’t mean it’s only used in HTTP handlers).

software design tip

Most of the time when you pass a boolean into a function, you are declaring that you’ve written a function that does two things. One thing for the true case and another for the false case. Instead, you should have written two functions, one for each case.

every time you use this function, you need to dive into the implementation details to understand the right value to be passed.

source: https://hackernoon.com/object-oriented-tricks-3-death-by-arguments-d070ac86d996