More error checks thanks to errcheck

This commit is contained in:
Enrico Stahn 2018-02-25 21:45:46 +11:00
parent 38b9c07ab7
commit 3ffe5787c8
No known key found for this signature in database
GPG key ID: 5263621C269A50DE
3 changed files with 10 additions and 3 deletions

View file

@ -45,7 +45,9 @@ var getCmd = &cobra.Command{
pm.Add(uri)
}
pm.Update()
if err := pm.Update(); err != nil {
log.Fatal("Could not update pool.", err)
}
switch output {
case "json":

View file

@ -103,7 +103,9 @@ to quickly create a Cobra application.`,
defer cancel()
// Doesn't block if no connections, but will otherwise wait
// until the timeout deadline.
srv.Shutdown(ctx)
if err := srv.Shutdown(ctx); err != nil {
log.Fatal("Error during shutdown", err)
}
// Optionally, you could run srv.Shutdown in a goroutine and block on
// <-ctx.Done() if your application should wait for other services
// to finalize based on context cancellation.
@ -136,7 +138,9 @@ func init() {
flag := serverCmd.Flags().Lookup(flag)
flag.Usage = fmt.Sprintf("%v [env %v]", flag.Usage, env)
if value := os.Getenv(env); value != "" {
flag.Value.Set(value)
if err := flag.Value.Set(value); err != nil {
log.Error(err)
}
}
}
}

View file

@ -15,6 +15,7 @@ package main
import (
"fmt"
"github.com/hipages/php-fpm_exporter/cmd"
)