feat: use default http client

main
sudo pacman -Syu 2023-07-30 15:19:55 +07:00
parent c21994e609
commit 0876e131b6
2 changed files with 2 additions and 11 deletions

View File

@ -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,
}

View File

@ -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)
}