From 2d609b8b31ab3dea7e9ae3f315e945082b23e8ad Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 6 Mar 2022 15:59:45 +0800 Subject: autofix: types of function parameters can be combined (#6800) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- internal/httplib/httplib.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'internal/httplib') diff --git a/internal/httplib/httplib.go b/internal/httplib/httplib.go index 1062d220..142eb7c5 100644 --- a/internal/httplib/httplib.go +++ b/internal/httplib/httplib.go @@ -27,9 +27,11 @@ import ( jsoniter "github.com/json-iterator/go" ) -var defaultSetting = Settings{false, "GogsServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false} -var defaultCookieJar http.CookieJar -var settingMutex sync.Mutex +var ( + defaultSetting = Settings{false, "GogsServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false} + defaultCookieJar http.CookieJar + settingMutex sync.Mutex +) // createDefaultCookie creates a global cookiejar to store cookies. func createDefaultCookie() { @@ -270,7 +272,7 @@ func (r *Request) getResponse() (*http.Response, error) { if err != nil { log.Fatal(err) } - //iocopy + // iocopy _, err = io.Copy(fileWriter, fh) _ = fh.Close() if err != nil { @@ -437,7 +439,7 @@ func (r *Request) Response() (*http.Response, error) { } // TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field. -func TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error) { +func TimeoutDialer(cTimeout, rwTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error) { return func(ctx context.Context, netw, addr string) (net.Conn, error) { conn, err := net.DialTimeout(netw, addr, cTimeout) if err != nil { -- cgit v1.2.3