November 2018
Intermediate to advanced
346 pages
8h 12m
English
As we saw in our dependency graph, just about everything depends on the config package. The primary cause of this is code that directly references a public global variable to configure itself. The first issue with this is how it affects the tests. All tests now pretty much make sure that the config global has been properly initialized before being run. Because all of the tests are using the same global variable, we are forced to choose between not changing the config, which hampers our ability to test, or running the tests in serial, which wastes our time.
Let's look at an example, as shown in the following code:
// bind stop channel to contextctx := context.Background()// start REST server ...
Read now
Unlock full access