diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2022-03-06 15:59:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 15:59:45 +0800 |
commit | 2d609b8b31ab3dea7e9ae3f315e945082b23e8ad (patch) | |
tree | 6b42670f567bdbc598abe5ca9f619dc608b49f36 /internal/httplib | |
parent | 3acc13038dfe5e0643112140d329c6eb0ed4cd6a (diff) |
autofix: types of function parameters can be combined (#6800)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/httplib')
-rw-r--r-- | internal/httplib/httplib.go | 12 |
1 files changed, 7 insertions, 5 deletions
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 { |