mirror of https://github.com/linkerd/linkerd2.git
Add Go vetting to Travis CI configuration (#128)
* Fix go vet warning in various go source files Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
This commit is contained in:
parent
0ee38e46f8
commit
2b22d4bc63
|
@ -42,6 +42,7 @@ jobs:
|
|||
# this or we should error if it dirties the repo.
|
||||
- ./bin/protoc-go.sh
|
||||
- go test -v ./...
|
||||
- go vet ./...
|
||||
- language: node_js
|
||||
node_js:
|
||||
- "8"
|
||||
|
|
|
@ -85,7 +85,7 @@ func (kctl *kubectl) StartProxy(potentialErrorWhenStartingProxy chan error, port
|
|||
fmt.Printf("Running `kubectl proxy -p %d`\n", port)
|
||||
|
||||
if kctl.ProxyPort() != portWhenProxyNotRunning {
|
||||
return fmt.Errorf("kubectl proxy already running on port [%d]", kctl.ProxyPort)
|
||||
return fmt.Errorf("kubectl proxy already running on port [%d]", kctl.ProxyPort())
|
||||
}
|
||||
|
||||
output, err := kctl.sh.AsyncStdout(potentialErrorWhenStartingProxy, "kubectl", "proxy", "-p", strconv.Itoa(port))
|
||||
|
|
|
@ -77,7 +77,7 @@ func TestKubectlStartProxy(t *testing.T) {
|
|||
}
|
||||
|
||||
if kctl.ProxyPort() != kubectlDefaultProxyPort {
|
||||
t.Fatalf("Expecting proxy to be running on [%d] but it's on [%d]", kubectlDefaultProxyPort, kctl.ProxyPort)
|
||||
t.Fatalf("Expecting proxy to be running on [%d] but it's on [%d]", kubectlDefaultProxyPort, kctl.ProxyPort())
|
||||
}
|
||||
|
||||
if shell.LastFullCommand() != "kubectl proxy -p 8001" {
|
||||
|
@ -105,7 +105,7 @@ func TestKubectlStartProxy(t *testing.T) {
|
|||
}
|
||||
|
||||
if kctl.ProxyPort() != kubectlDefaultProxyPort {
|
||||
t.Fatalf("Expected proxy to keep running on port [%d] but got [%d]", kubectlDefaultProxyPort, kctl.ProxyPort)
|
||||
t.Fatalf("Expected proxy to keep running on port [%d] but got [%d]", kubectlDefaultProxyPort, kctl.ProxyPort())
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ func TestWaitForCharacter(t *testing.T) {
|
|||
}
|
||||
|
||||
if strings.TrimSpace(outputString) != expectedOutput {
|
||||
t.Fatalf("Expecting command output to be [%s], got [%s]", expectedOutput, output)
|
||||
t.Fatalf("Expecting command output to be [%s], got [%s]", expectedOutput, strings.TrimSpace(outputString))
|
||||
}
|
||||
|
||||
select {
|
||||
|
|
|
@ -195,7 +195,7 @@ func expectCannotConnectGetRequestTo(t *testing.T, host string, port string) {
|
|||
fmt.Printf("Expecting failed GET to %s\n", targetUrl)
|
||||
resp, err := http.Get(targetUrl)
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error when connecting to %s, got:\n%s", targetUrl, resp)
|
||||
t.Fatalf("Expected error when connecting to %s, got:\n%+v", targetUrl, resp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ func response() string {
|
|||
}
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Starting stub HTTP server on port [%s] will serve [%s] proxy [%s]", port, hostname, amITheProxy)
|
||||
fmt.Printf("Starting stub HTTP server on port [%s] will serve [%s] proxy [%t]", port, hostname, amITheProxy)
|
||||
|
||||
http.HandleFunc("/", returnHostAndPortHandler)
|
||||
http.HandleFunc("/call", callOtherServiceHandler)
|
||||
|
|
|
@ -38,11 +38,11 @@ func main() {
|
|||
|
||||
_, _, err = net.SplitHostPort(*kubernetesApiHost) // Verify kubernetesApiHost is of the form host:port.
|
||||
if err != nil {
|
||||
log.Fatalf("failed to parse API server address: %s", kubernetesApiHost)
|
||||
log.Fatalf("failed to parse API server address: %s", *kubernetesApiHost)
|
||||
}
|
||||
client, err := public.NewInternalClient(*kubernetesApiHost)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to construct client for API server URL %s", kubernetesApiHost)
|
||||
log.Fatalf("failed to construct client for API server URL %s", *kubernetesApiHost)
|
||||
}
|
||||
|
||||
stop := make(chan os.Signal, 1)
|
||||
|
@ -64,6 +64,7 @@ func main() {
|
|||
<-stop
|
||||
|
||||
log.Info("shutting down HTTP server on", *addr)
|
||||
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
server.Shutdown(ctx)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue