diff --git a/client_test.go b/client_test.go index 4ef9ec5..401d41f 100644 --- a/client_test.go +++ b/client_test.go @@ -73,9 +73,9 @@ func testConn(t *testing.T, disableEPSV bool) { if err != nil { t.Error(err) } else { - buf, err := ioutil.ReadAll(r) + buf, errRead := ioutil.ReadAll(r) if err != nil { - t.Error(err) + t.Error(errRead) } if string(buf) != testData { t.Errorf("'%s'", buf) @@ -90,7 +90,7 @@ func testConn(t *testing.T, disableEPSV bool) { t.Error(err) } else { r.SetDeadline(time.Now()) - _, err := ioutil.ReadAll(r) + _, err = ioutil.ReadAll(r) if err == nil { t.Error("deadline should have caused error") } else if !strings.HasSuffix(err.Error(), "i/o timeout") { @@ -104,9 +104,9 @@ func testConn(t *testing.T, disableEPSV bool) { if err != nil { t.Error(err) } else { - buf, err := ioutil.ReadAll(r) - if err != nil { - t.Error(err) + buf, errRead := ioutil.ReadAll(r) + if errRead != nil { + t.Error(errRead) } expected := testData[5:] if string(buf) != expected { @@ -126,9 +126,9 @@ func testConn(t *testing.T, disableEPSV bool) { if err != nil { t.Error(err) } else { - buf, err := ioutil.ReadAll(r) + buf, errRead := ioutil.ReadAll(r) if err != nil { - t.Error(err) + t.Error(errRead) } if string(buf) != testData+testData { t.Errorf("'%s'", buf) @@ -193,7 +193,7 @@ func testConn(t *testing.T, disableEPSV bool) { } } - if err := c.Quit(); err != nil { + if err = c.Quit(); err != nil { t.Fatal(err) } diff --git a/ftp.go b/ftp.go index b6d6b8c..0a96169 100644 --- a/ftp.go +++ b/ftp.go @@ -309,10 +309,10 @@ func (c *ServerConn) Login(user, password string) error { // If using implicit TLS, make data connections also use TLS if c.options.tlsConfig != nil { - if _, _, err := c.cmd(StatusCommandOK, "PBSZ 0"); err != nil { + if _, _, err = c.cmd(StatusCommandOK, "PBSZ 0"); err != nil { return err } - if _, _, err := c.cmd(StatusCommandOK, "PROT P"); err != nil { + if _, _, err = c.cmd(StatusCommandOK, "PROT P"); err != nil { return err } } @@ -516,7 +516,7 @@ func (c *ServerConn) cmdDataConnFrom(offset uint64, format string, args ...inter } if offset != 0 { - _, _, err := c.cmd(StatusRequestFilePending, "REST %d", offset) + _, _, err = c.cmd(StatusRequestFilePending, "REST %d", offset) if err != nil { _ = conn.Close() return nil, err @@ -603,8 +603,8 @@ func (c *ServerConn) List(path string) (entries []*Entry, err error) { scanner := bufio.NewScanner(r) now := time.Now() for scanner.Scan() { - entry, err := parser(scanner.Text(), now, c.options.location) - if err == nil { + entry, errParse := parser(scanner.Text(), now, c.options.location) + if errParse == nil { entries = append(entries, entry) } }