Commit c981b08b authored by buddhamagnet's avatar buddhamagnet

correct unused assignments

parent 7271b571
...@@ -116,7 +116,7 @@ func TestRedirPlaintextHost(t *testing.T) { ...@@ -116,7 +116,7 @@ func TestRedirPlaintextHost(t *testing.T) {
// browsers can infer a default port from scheme, so make sure the port // 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. // doesn't get added in explicitly for default ports like 443 for https.
cfg = redirPlaintextHost(server.Config{Host: "example.com", Port: "443"}) 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 { 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) t.Errorf("(Default Port) Expected redirect rule to be to URL '%s' but is actually to '%s'", expected, actual)
} }
......
...@@ -40,7 +40,7 @@ func TestErrors(t *testing.T) { ...@@ -40,7 +40,7 @@ func TestErrors(t *testing.T) {
if len(c.Startup) == 0 { if len(c.Startup) == 0 {
t.Fatal("Expected 1 startup function, had 0") t.Fatal("Expected 1 startup function, had 0")
} }
err = c.Startup[0]() c.Startup[0]()
if myHandler.Log == nil { if myHandler.Log == nil {
t.Error("Expected Log to be non-nil after startup because Debug is not enabled") t.Error("Expected Log to be non-nil after startup because Debug is not enabled")
} }
......
...@@ -62,7 +62,7 @@ func webSocketParse(c *Controller) ([]websocket.Config, error) { ...@@ -62,7 +62,7 @@ func webSocketParse(c *Controller) ([]websocket.Config, error) {
} }
// Okay, check again for optional block // Okay, check again for optional block
hadBlock, err = optionalBlock() _, err = optionalBlock()
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -131,7 +131,7 @@ func TestBrowseTemplate(t *testing.T) { ...@@ -131,7 +131,7 @@ func TestBrowseTemplate(t *testing.T) {
rec := httptest.NewRecorder() rec := httptest.NewRecorder()
code, err := b.ServeHTTP(rec, req) code, _ := b.ServeHTTP(rec, req)
if code != http.StatusOK { if code != http.StatusOK {
t.Fatalf("Wrong status, expected %d, got %d", http.StatusOK, code) t.Fatalf("Wrong status, expected %d, got %d", http.StatusOK, code)
} }
......
...@@ -113,7 +113,6 @@ func parseWindowsCommand(cmd string) []string { ...@@ -113,7 +113,6 @@ func parseWindowsCommand(cmd string) []string {
if len(part) > 0 { if len(part) > 0 {
parts = append(parts, part) parts = append(parts, part)
part = ""
} }
return parts return parts
......
...@@ -153,7 +153,6 @@ func (c Context) StripHTML(s string) string { ...@@ -153,7 +153,6 @@ func (c Context) StripHTML(s string) string {
if inTag { if inTag {
// false start // false start
buf.WriteString(s[tagStart:]) buf.WriteString(s[tagStart:])
inTag = false
} }
return buf.String() return buf.String()
} }
......
...@@ -149,7 +149,7 @@ func (rec *record) read(r io.Reader) (buf []byte, err error) { ...@@ -149,7 +149,7 @@ func (rec *record) read(r io.Reader) (buf []byte, err error) {
if len(rec.rbuf) < n { if len(rec.rbuf) < n {
rec.rbuf = make([]byte, 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 return
} }
buf = rec.rbuf[:int(rec.h.ContentLength)] buf = rec.rbuf[:int(rec.h.ContentLength)]
......
...@@ -149,7 +149,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[ ...@@ -149,7 +149,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
} }
defer resp.Body.Close() defer resp.Body.Close()
content, err = ioutil.ReadAll(resp.Body) content, _ = ioutil.ReadAll(resp.Body)
log.Println("c: send data length ≈", length, string(content)) log.Println("c: send data length ≈", length, string(content))
fcgi.Close() fcgi.Close()
......
...@@ -37,7 +37,7 @@ func TestInternal(t *testing.T) { ...@@ -37,7 +37,7 @@ func TestInternal(t *testing.T) {
} }
rec := httptest.NewRecorder() rec := httptest.NewRecorder()
code, err := im.ServeHTTP(rec, req) code, _ := im.ServeHTTP(rec, req)
if code != test.expectedCode { if code != test.expectedCode {
t.Errorf("Test %d: Expected status code %d for %s, but got %d", t.Errorf("Test %d: Expected status code %d for %s, but got %d",
......
...@@ -206,7 +206,7 @@ func TestParsers(t *testing.T) { ...@@ -206,7 +206,7 @@ func TestParsers(t *testing.T) {
} }
// front matter but no body // 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) t.Fatalf("Unexpected error for valid metadata but no body for %v", v.name)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment