The os/exec package lets a Go application call another operating-system application. In varied cloud environments, validate each external dependency before its first use rather than assuming it is installed. section 12.4.1
Check a dependency before calling it
func checkDep(name string) error { if _, err := exec.LookPath(name); err != nil { return fmt.Errorf("Could not find '%s' in PATH: %s", name, err) } return nil } err := checkDep("fortune") if err != nil { log.Fatalln(err) } fmt.Println("Time to get your fortune") LookPath searches PATH and returns an error when the named application is unavailable. Logging that error makes deployment failures easier to troubleshoot. section 12.4.1
