error strings should not be capitalized (ST1005)

This commit is contained in:
Julien Laffaye 2019-01-22 14:50:39 +01:00
parent 509a294b60
commit f75dead520
2 changed files with 7 additions and 7 deletions

8
ftp.go
View File

@ -217,7 +217,7 @@ func (c *ServerConn) epsv() (port int, err error) {
start := strings.Index(line, "|||") start := strings.Index(line, "|||")
end := strings.LastIndex(line, "|") end := strings.LastIndex(line, "|")
if start == -1 || end == -1 { if start == -1 || end == -1 {
err = errors.New("Invalid EPSV response format") err = errors.New("invalid EPSV response format")
return return
} }
port, err = strconv.Atoi(line[start+3 : end]) port, err = strconv.Atoi(line[start+3 : end])
@ -235,7 +235,7 @@ func (c *ServerConn) pasv() (host string, port int, err error) {
start := strings.Index(line, "(") start := strings.Index(line, "(")
end := strings.LastIndex(line, ")") end := strings.LastIndex(line, ")")
if start == -1 || end == -1 { if start == -1 || end == -1 {
err = errors.New("Invalid PASV response format") err = errors.New("invalid PASV response format")
return return
} }
@ -243,7 +243,7 @@ func (c *ServerConn) pasv() (host string, port int, err error) {
pasvData := strings.Split(line[start+1:end], ",") pasvData := strings.Split(line[start+1:end], ",")
if len(pasvData) < 6 { if len(pasvData) < 6 {
err = errors.New("Invalid PASV response format") err = errors.New("invalid PASV response format")
return return
} }
@ -421,7 +421,7 @@ func (c *ServerConn) CurrentDir() (string, error) {
end := strings.LastIndex(msg, "\"") end := strings.LastIndex(msg, "\"")
if start == -1 || end == -1 { if start == -1 || end == -1 {
return "", errors.New("Unsuported PWD response format") return "", errors.New("unsuported PWD response format")
} }
return msg[start+1 : end], nil return msg[start+1 : end], nil

View File

@ -8,7 +8,7 @@ import (
"time" "time"
) )
var errUnsupportedListLine = errors.New("Unsupported LIST line") var errUnsupportedListLine = errors.New("unsupported LIST line")
type parseFunc func(string, time.Time, *time.Location) (*Entry, error) type parseFunc func(string, time.Time, *time.Location) (*Entry, error)
@ -132,7 +132,7 @@ func parseLsListLine(line string, now time.Time, loc *time.Location) (*Entry, er
case 'l': case 'l':
e.Type = EntryTypeLink e.Type = EntryTypeLink
default: default:
return nil, errors.New("Unknown entry type") return nil, errors.New("unknown entry type")
} }
if err := e.setTime(fields[5:8], now, loc); err != nil { if err := e.setTime(fields[5:8], now, loc); err != nil {
@ -246,7 +246,7 @@ func (e *Entry) setTime(fields []string, now time.Time, loc *time.Location) (err
} else { // only the date } else { // only the date
if len(fields[2]) != 4 { if len(fields[2]) != 4 {
return errors.New("Invalid year format in time string") return errors.New("invalid year format in time string")
} }
timeStr := fmt.Sprintf("%s %s %s 00:00", fields[1], fields[0], fields[2]) timeStr := fmt.Sprintf("%s %s %s 00:00", fields[1], fields[0], fields[2])
e.Time, err = time.ParseInLocation("_2 Jan 2006 15:04", timeStr, loc) e.Time, err = time.ParseInLocation("_2 Jan 2006 15:04", timeStr, loc)