Fix vet and lint issues (#88)
authorTristan Colgate-McFarlane <tcolgate@gmail.com>
Thu, 15 Dec 2016 10:42:02 +0000 (10:42 +0000)
committerBrian Brazil <brian-brazil@users.noreply.github.com>
Thu, 15 Dec 2016 10:42:02 +0000 (10:42 +0000)
dns_test.go
http.go
icmp.go

index 8982f3eadbcc3ebcfe197777e4a86786cdfcfb85..39fea3983d1b69cb6a7233ba6490c84902082906 100644 (file)
@@ -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 8993f92276c9282e356bc851552e8cde06d7bf90..0a009f83a11e62e957141ebf0717950e707ea5d7 100644 (file)
--- 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 cb8cf599644c02c4b2daf0d0c95efe0cf5e87f87..86f9a6e40239a8b40f9f63580a303014267601b3 100644 (file)
--- 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
 }