From: Tristan Colgate-McFarlane Date: Thu, 15 Dec 2016 10:42:02 +0000 (+0000) Subject: Fix vet and lint issues (#88) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1722550ff00dc7435e8b39adf292bfc51b69c26f;p=blackbox_exporter.git Fix vet and lint issues (#88) --- diff --git a/dns_test.go b/dns_test.go index 8982f3e..39fea39 100644 --- a/dns_test.go +++ b/dns_test.go @@ -442,11 +442,11 @@ func TestDNSProtocol(t *testing.T) { body = recorder.Body.String() if protocol == "udp" { if !result { - t.Fatalf("DNS test connection with protocol unspecified failed, expected success.", protocol) + t.Fatalf("DNS test connection with protocol %s failed, expected success.", protocol) } } else { if result { - t.Fatalf("DNS test connection with protocol unspecified succeeded, expected failure.", protocol) + t.Fatalf("DNS test connection with protocol %s succeeded, expected failure.", protocol) } } if !strings.Contains(body, "probe_ip_protocol 6\n") { diff --git a/http.go b/http.go index 8993f92..0a009f8 100644 --- a/http.go +++ b/http.go @@ -80,18 +80,18 @@ func probeHTTP(target string, w http.ResponseWriter, module Module) (success boo dialProtocol = module.HTTP.Protocol if module.HTTP.Protocol == "tcp" { - target_url, err := url.Parse(target) + targetURL, err := url.Parse(target) if err != nil { return false } - target_host, _, err := net.SplitHostPort(target_url.Host) + targetHost, _, err := net.SplitHostPort(targetURL.Host) // If split fails, assuming it's a hostname without port part if err != nil { - target_host = target_url.Host + targetHost = targetURL.Host } - ip, err := net.ResolveIPAddr(module.HTTP.PreferredIpProtocol, target_host) + ip, err := net.ResolveIPAddr(module.HTTP.PreferredIpProtocol, targetHost) if err != nil { - ip, err = net.ResolveIPAddr(fallbackProtocol, target_host) + ip, err = net.ResolveIPAddr(fallbackProtocol, targetHost) if err != nil { return false } diff --git a/icmp.go b/icmp.go index cb8cf59..86f9a6e 100644 --- a/icmp.go +++ b/icmp.go @@ -16,15 +16,16 @@ package main import ( "bytes" "fmt" - "golang.org/x/net/icmp" - "golang.org/x/net/ipv4" - "golang.org/x/net/ipv6" "net" "net/http" "os" "sync" "time" + "golang.org/x/net/icmp" + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" + "github.com/prometheus/common/log" ) @@ -36,7 +37,7 @@ var ( func getICMPSequence() uint16 { icmpSequenceMutex.Lock() defer icmpSequenceMutex.Unlock() - icmpSequence += 1 + icmpSequence++ return icmpSequence } @@ -161,5 +162,4 @@ func probeICMP(target string, w http.ResponseWriter, module Module) (success boo return } } - return }