From: Ben Kochie Date: Sat, 26 Aug 2017 15:24:50 +0000 (+0200) Subject: Fix staticcheck errors. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fd1a99951839d06d18e867842c00fcf5a70abbba;p=blackbox_exporter.git Fix staticcheck errors. --- diff --git a/main.go b/main.go index 38ff7bd..1645976 100644 --- a/main.go +++ b/main.go @@ -190,7 +190,7 @@ func main() { http.Error(w, fmt.Sprintf("failed to reload config: %s", err), http.StatusInternalServerError) } }) - http.Handle("/metrics", prometheus.Handler()) + http.Handle("/metrics", promhttp.Handler()) http.HandleFunc("/probe", func(w http.ResponseWriter, r *http.Request) { sc.Lock() conf := sc.C diff --git a/tcp_test.go b/tcp_test.go index 37a3241..a612317 100644 --- a/tcp_test.go +++ b/tcp_test.go @@ -35,7 +35,7 @@ func TestTCPConnection(t *testing.T) { go func() { conn, err := ln.Accept() if err != nil { - t.Fatalf("Error accepting on socket: %s", err) + panic(fmt.Sprintf("Error accepting on socket: %s", err)) } conn.Close() ch <- struct{}{} @@ -83,7 +83,7 @@ func TestTCPConnectionQueryResponseIRC(t *testing.T) { go func() { conn, err := ln.Accept() if err != nil { - t.Fatalf("Error accepting on socket: %s", err) + panic(fmt.Sprintf("Error accepting on socket: %s", err)) } fmt.Fprintf(conn, ":ircd.localhost NOTICE AUTH :*** Looking up your hostname...\n") var nick, user, mode, unused, realname string @@ -102,7 +102,7 @@ func TestTCPConnectionQueryResponseIRC(t *testing.T) { go func() { conn, err := ln.Accept() if err != nil { - t.Fatalf("Error accepting on socket: %s", err) + panic(fmt.Sprintf("Error accepting on socket: %s", err)) } fmt.Fprintf(conn, ":ircd.localhost NOTICE AUTH :*** Looking up your hostname...\n") var nick, user, mode, unused, realname string @@ -152,7 +152,7 @@ func TestTCPConnectionQueryResponseMatching(t *testing.T) { go func() { conn, err := ln.Accept() if err != nil { - t.Fatalf("Error accepting on socket: %s", err) + panic(fmt.Sprintf("Error accepting on socket: %s", err)) } conn.SetDeadline(time.Now().Add(1 * time.Second)) fmt.Fprintf(conn, "SSH-2.0-OpenSSH_6.9p1 Debian-2\n") @@ -334,7 +334,7 @@ func TestPrometheusTimeoutTCP(t *testing.T) { go func() { conn, err := ln.Accept() if err != nil { - t.Fatalf("Error accepting on socket: %s", err) + panic(fmt.Sprintf("Error accepting on socket: %s", err)) } conn.Close() ch <- struct{}{}