Tom C inherited some Go from another developer, and writes, “I’m pretty sick of finding this sort of stuff in this code.”

	if log, err = dockerservice.GetLoggerInstance(); err != nil {
		log.Err(fmt.Sprintf("Logger error: %v \n", err))
  }

It’s good to log every error- it’ll help in the long run when you’re trying to trace through the problem which happens in production but the program works fine on your machine. This code knows that accessing the logger object is code that can throw an error, so if it gets an error fetching the logger object it… logs the error. With the logger object that returned some kind of error.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!