Skip to content

Commit

Permalink
fix: replace http.DefaultClient to httpclient.Client
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Oct 12, 2024
1 parent 60ba7a9 commit 6a4432e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/cli/exec/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package exec

import (
"fmt"
"net/http"

"github.com/aquaproj/aqua/v2/pkg/cli/profile"
"github.com/aquaproj/aqua/v2/pkg/cli/util"
"github.com/aquaproj/aqua/v2/pkg/cli/which"
"github.com/aquaproj/aqua/v2/pkg/config"
"github.com/aquaproj/aqua/v2/pkg/controller"
"github.com/aquaproj/aqua/v2/pkg/httpclient"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -46,7 +46,7 @@ func (i *command) action(c *cli.Context) error {
if err := util.SetParam(c, i.r.LogE, "exec", param, i.r.LDFlags); err != nil {
return fmt.Errorf("parse the command line arguments: %w", err)
}
ctrl, err := controller.InitializeExecCommandController(c.Context, param, http.DefaultClient, i.r.Runtime)
ctrl, err := controller.InitializeExecCommandController(c.Context, param, httpclient.Client, i.r.Runtime)
if err != nil {
return fmt.Errorf("initialize a ExecController: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/install/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package install

import (
"fmt"
"net/http"

"github.com/aquaproj/aqua/v2/pkg/cli/profile"
"github.com/aquaproj/aqua/v2/pkg/cli/util"
"github.com/aquaproj/aqua/v2/pkg/config"
"github.com/aquaproj/aqua/v2/pkg/controller"
"github.com/aquaproj/aqua/v2/pkg/httpclient"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -84,7 +84,7 @@ func (i *command) action(c *cli.Context) error {
if err := util.SetParam(c, i.r.LogE, "install", param, i.r.LDFlags); err != nil {
return fmt.Errorf("parse the command line arguments: %w", err)
}
ctrl, err := controller.InitializeInstallCommandController(c.Context, param, http.DefaultClient, i.r.Runtime)
ctrl, err := controller.InitializeInstallCommandController(c.Context, param, httpclient.Client, i.r.Runtime)
if err != nil {
return fmt.Errorf("initialize a InstallController: %w", err)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/httpclient/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package httpclient

import "net/http"

var Client = &http.Client{}

Check failure on line 5 in pkg/httpclient/client.go

View workflow job for this annotation

GitHub Actions / test / test

Client is a global variable (gochecknoglobals)

0 comments on commit 6a4432e

Please sign in to comment.