Be Paranoid About Your Third Party Dependencies

With any programming language and its ecosystem, developers need to be judicious about the third-party dependencies they bring in. Go is no different, though it can be sometimes be astonishing how simple it is for a third-party package to wreak havoc with your program.

Case in point:

In Go, it’s a common practice to represent errors as variables using the following syntax:

package foo

import errors

var ErrFoo = errors.New("foo error")

The above code creates an error type called ErrFoo. Following Go convention, since the variable name is capitalized, it will be exported outside of its package and available to other packages that want to reference it.

One quirk of Go is that these error variables defined in this manner are modifiable. So another unrelated package can change the value of ErrFoo to something else.

Continue reading “Be Paranoid About Your Third Party Dependencies”

Writing Robust Concurrency Tests In Go Using a CountDownLatch

Recently, while writing tests involving concurrency in Go, I encountered the common situation of needing to wait for a series of events across multiple goroutines to complete before proceeding with further code execution.

Continue reading “Writing Robust Concurrency Tests In Go Using a CountDownLatch”

Rockets Game 7 Collapse – Chance or Something Else?

Game 7 of the NBA Western Conference Finals between the Houston Rockets and Golden State Warriors was the pivotal game of the 2018 NBA playoffs. The Rockets and Warriors were widely regarded as the two best teams all season. The Warriors won the game, coming back from a double-digit deficit, and then went on to sweep the Cleveland Cavaliers in the NBA Finals.

One of the most talked about aspects of Game 7 was the Rockets’ poor 3 point shooting, especially during a stretch in the second half when the Rockets missed 27 straight 3 pointers, an NBA record.

Continue reading “Rockets Game 7 Collapse – Chance or Something Else?”