fix golint issues, else blocks (#457)

This commit is contained in:
Kevin Wan
2021-02-09 13:50:21 +08:00
committed by GitHub
parent 42883d0899
commit 5e969cbef0
66 changed files with 341 additions and 311 deletions

View File

@@ -315,12 +315,13 @@ func buildRequest(rs requestSettings) (*http.Request, error) {
var path string
var query string
if len(rs.requestUri) > 0 {
if u, err := url.Parse(rs.requestUri); err != nil {
u, err := url.Parse(rs.requestUri)
if err != nil {
return nil, err
} else {
path = u.Path
query = u.RawQuery
}
path = u.Path
query = u.RawQuery
} else {
path = r.URL.Path
query = r.URL.RawQuery
@@ -377,10 +378,9 @@ func createTempFile(body []byte) (string, error) {
tmpFile, err := ioutil.TempFile(os.TempDir(), "go-unit-*.tmp")
if err != nil {
return "", err
} else {
tmpFile.Close()
}
tmpFile.Close()
err = ioutil.WriteFile(tmpFile.Name(), body, os.ModePerm)
if err != nil {
return "", err