Fixed govet issues

This commit is contained in:
Víctor Zamanillo 2020-09-25 17:54:10 +02:00
parent 4129b88c92
commit bdc394abea
3 changed files with 7 additions and 7 deletions

View File

@ -51,10 +51,10 @@ func ParseRequest(req string) (method string, path string, headers map[string]st
method = parts[0]
for {
line, err := reader.ReadString('\n')
line, readErr := reader.ReadString('\n')
line = strings.TrimSpace(line)
if err != nil || line == "" {
if readErr != nil || line == "" {
break
}

View File

@ -77,9 +77,9 @@ func New(options *Options) (*HTTPX, error) {
}
if httpx.Options.HttpProxy != "" {
proxyURL, err := url.Parse(httpx.Options.HttpProxy)
if err != nil {
return nil, err
proxyURL, parseErr := url.Parse(httpx.Options.HttpProxy)
if parseErr != nil {
return nil, parseErr
}
transport.Proxy = http.ProxyURL(proxyURL)
}

View File

@ -21,8 +21,8 @@ func StringToSliceInt(s string) ([]int, error) {
return r, nil
}
for _, v := range strings.Split(s, ",") {
v := strings.TrimSpace(v)
if i, err := strconv.Atoi(v); err == nil {
vTrim := strings.TrimSpace(v)
if i, err := strconv.Atoi(vTrim); err == nil {
r = append(r, i)
} else {
return r, err