From c981b08b23de35060dcf5b7fe73a2963b68d0351 Mon Sep 17 00:00:00 2001 From: buddhamagnet Date: Sat, 26 Mar 2016 21:05:19 +0000 Subject: [PATCH] correct unused assignments --- caddy/https/https_test.go | 2 +- caddy/setup/errors_test.go | 2 +- caddy/setup/websocket.go | 2 +- middleware/browse/browse_test.go | 2 +- middleware/commands.go | 1 - middleware/context.go | 1 - middleware/fastcgi/fcgiclient.go | 2 +- middleware/fastcgi/fcgiclient_test.go | 2 +- middleware/inner/internal_test.go | 2 +- middleware/markdown/metadata_test.go | 2 +- 10 files changed, 8 insertions(+), 10 deletions(-) diff --git a/caddy/https/https_test.go b/caddy/https/https_test.go index e06af138..0f118f09 100644 --- a/caddy/https/https_test.go +++ b/caddy/https/https_test.go @@ -116,7 +116,7 @@ func TestRedirPlaintextHost(t *testing.T) { // browsers can infer a default port from scheme, so make sure the port // doesn't get added in explicitly for default ports like 443 for https. cfg = redirPlaintextHost(server.Config{Host: "example.com", Port: "443"}) - handler, ok = cfg.Middleware[0](nil).(redirect.Redirect) + handler, _ = cfg.Middleware[0](nil).(redirect.Redirect) if actual, expected := handler.Rules[0].To, "https://{host}{uri}"; actual != expected { t.Errorf("(Default Port) Expected redirect rule to be to URL '%s' but is actually to '%s'", expected, actual) } diff --git a/caddy/setup/errors_test.go b/caddy/setup/errors_test.go index 216c5de8..ace04624 100644 --- a/caddy/setup/errors_test.go +++ b/caddy/setup/errors_test.go @@ -40,7 +40,7 @@ func TestErrors(t *testing.T) { if len(c.Startup) == 0 { t.Fatal("Expected 1 startup function, had 0") } - err = c.Startup[0]() + c.Startup[0]() if myHandler.Log == nil { t.Error("Expected Log to be non-nil after startup because Debug is not enabled") } diff --git a/caddy/setup/websocket.go b/caddy/setup/websocket.go index 33df76d7..17617c40 100644 --- a/caddy/setup/websocket.go +++ b/caddy/setup/websocket.go @@ -62,7 +62,7 @@ func webSocketParse(c *Controller) ([]websocket.Config, error) { } // Okay, check again for optional block - hadBlock, err = optionalBlock() + _, err = optionalBlock() if err != nil { return nil, err } diff --git a/middleware/browse/browse_test.go b/middleware/browse/browse_test.go index f90f4f6f..884d0394 100644 --- a/middleware/browse/browse_test.go +++ b/middleware/browse/browse_test.go @@ -131,7 +131,7 @@ func TestBrowseTemplate(t *testing.T) { rec := httptest.NewRecorder() - code, err := b.ServeHTTP(rec, req) + code, _ := b.ServeHTTP(rec, req) if code != http.StatusOK { t.Fatalf("Wrong status, expected %d, got %d", http.StatusOK, code) } diff --git a/middleware/commands.go b/middleware/commands.go index 5c241161..2aaeb614 100644 --- a/middleware/commands.go +++ b/middleware/commands.go @@ -113,7 +113,6 @@ func parseWindowsCommand(cmd string) []string { if len(part) > 0 { parts = append(parts, part) - part = "" } return parts diff --git a/middleware/context.go b/middleware/context.go index 272bee4a..ea63d3e2 100644 --- a/middleware/context.go +++ b/middleware/context.go @@ -153,7 +153,6 @@ func (c Context) StripHTML(s string) string { if inTag { // false start buf.WriteString(s[tagStart:]) - inTag = false } return buf.String() } diff --git a/middleware/fastcgi/fcgiclient.go b/middleware/fastcgi/fcgiclient.go index 7f7f82e9..f443f63d 100644 --- a/middleware/fastcgi/fcgiclient.go +++ b/middleware/fastcgi/fcgiclient.go @@ -149,7 +149,7 @@ func (rec *record) read(r io.Reader) (buf []byte, err error) { if len(rec.rbuf) < n { rec.rbuf = make([]byte, n) } - if n, err = io.ReadFull(r, rec.rbuf[:n]); err != nil { + if _, err = io.ReadFull(r, rec.rbuf[:n]); err != nil { return } buf = rec.rbuf[:int(rec.h.ContentLength)] diff --git a/middleware/fastcgi/fcgiclient_test.go b/middleware/fastcgi/fcgiclient_test.go index 04a01c52..fed5f2da 100644 --- a/middleware/fastcgi/fcgiclient_test.go +++ b/middleware/fastcgi/fcgiclient_test.go @@ -149,7 +149,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[ } defer resp.Body.Close() - content, err = ioutil.ReadAll(resp.Body) + content, _ = ioutil.ReadAll(resp.Body) log.Println("c: send data length ≈", length, string(content)) fcgi.Close() diff --git a/middleware/inner/internal_test.go b/middleware/inner/internal_test.go index 528fd395..97078feb 100644 --- a/middleware/inner/internal_test.go +++ b/middleware/inner/internal_test.go @@ -37,7 +37,7 @@ func TestInternal(t *testing.T) { } rec := httptest.NewRecorder() - code, err := im.ServeHTTP(rec, req) + code, _ := im.ServeHTTP(rec, req) if code != test.expectedCode { t.Errorf("Test %d: Expected status code %d for %s, but got %d", diff --git a/middleware/markdown/metadata_test.go b/middleware/markdown/metadata_test.go index a4b7565b..1c3fc6a4 100644 --- a/middleware/markdown/metadata_test.go +++ b/middleware/markdown/metadata_test.go @@ -206,7 +206,7 @@ func TestParsers(t *testing.T) { } // front matter but no body - if md, err = v.parser.Parse([]byte(v.testData[4])); err != nil { + if _, err = v.parser.Parse([]byte(v.testData[4])); err != nil { t.Fatalf("Unexpected error for valid metadata but no body for %v", v.name) } }