feat: use default http client
parent
c21994e609
commit
0876e131b6
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue