From 0876e131b6649c1514369e0526949ff24314c8bb Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Sun, 30 Jul 2023 15:19:55 +0700 Subject: [PATCH] feat: use default http client --- internal/config/config.go | 8 -------- internal/config/config_real.go | 5 ++--- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 111ccfe..bed79ad 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -4,10 +4,8 @@ import ( "encoding/json" "errors" "fmt" - "net/http" "os" "path/filepath" - "time" "github.com/BurntSushi/toml" ) @@ -77,9 +75,6 @@ func loadConfigJSON(path string) (*ConfigReal, *ConfigDemo, error) { } cfgReal := ConfigReal{ - httpClient: &http.Client{ - Timeout: time.Second * 5, - }, ConfigApps: cfgApps, } @@ -104,9 +99,6 @@ func loadConfigTOML(path string) (*ConfigReal, *ConfigDemo, error) { } cfgReal := ConfigReal{ - httpClient: &http.Client{ - Timeout: time.Second * 5, - }, ConfigApps: cfgApps, } diff --git a/internal/config/config_real.go b/internal/config/config_real.go index 420b704..bf60c73 100644 --- a/internal/config/config_real.go +++ b/internal/config/config_real.go @@ -17,7 +17,6 @@ import ( var ErrConfigInvalid = errors.New("config invalid") type ConfigReal struct { - httpClient *http.Client ConfigApps } @@ -105,8 +104,8 @@ func (c *ConfigReal) Download() error { } eg.Go(func() error { - // nolint:noctx - httpRsp, err := c.httpClient.Get(p.URL) + // nolint:noctx,gosec + httpRsp, err := http.Get(p.URL) if err != nil { return fmt.Errorf("http client: failed to get: %w", err) }