diff --git a/build/invoke.go b/build/invoke.go index eb17e0b2..8e917ee0 100644 --- a/build/invoke.go +++ b/build/invoke.go @@ -37,7 +37,7 @@ func NewContainer(ctx context.Context, resultCtx *ResultHandle, cfg *controllera cancel() }() - containerCfg, err := resultCtx.getContainerConfig(ctx, c, cfg) + containerCfg, err := resultCtx.getContainerConfig(cfg) if err != nil { return nil, err } diff --git a/build/result.go b/build/result.go index b571cb66..d7e63efa 100644 --- a/build/result.go +++ b/build/result.go @@ -292,10 +292,10 @@ func (r *ResultHandle) build(buildFunc gateway.BuildFunc) (err error) { return err } -func (r *ResultHandle) getContainerConfig(ctx context.Context, c gateway.Client, cfg *controllerapi.InvokeConfig) (containerCfg gateway.NewContainerRequest, _ error) { +func (r *ResultHandle) getContainerConfig(cfg *controllerapi.InvokeConfig) (containerCfg gateway.NewContainerRequest, _ error) { if r.res != nil && r.solveErr == nil { logrus.Debugf("creating container from successful build") - ccfg, err := containerConfigFromResult(ctx, r.res, c, *cfg) + ccfg, err := containerConfigFromResult(r.res, *cfg) if err != nil { return containerCfg, err } @@ -327,7 +327,7 @@ func (r *ResultHandle) getProcessConfig(cfg *controllerapi.InvokeConfig, stdin i return processCfg, nil } -func containerConfigFromResult(ctx context.Context, res *gateway.Result, c gateway.Client, cfg controllerapi.InvokeConfig) (*gateway.NewContainerRequest, error) { +func containerConfigFromResult(res *gateway.Result, cfg controllerapi.InvokeConfig) (*gateway.NewContainerRequest, error) { if cfg.Initial { return nil, errors.Errorf("starting from the container from the initial state of the step is supported only on the failed steps") } diff --git a/commands/build.go b/commands/build.go index 6f151d49..f51d8551 100644 --- a/commands/build.go +++ b/commands/build.go @@ -340,7 +340,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) if confutil.IsExperimental() { resp, retErr = runControllerBuild(ctx, dockerCli, opts, options, printer) } else { - resp, retErr = runBasicBuild(ctx, dockerCli, opts, options, printer) + resp, retErr = runBasicBuild(ctx, dockerCli, opts, printer) } if err := printer.Wait(); retErr == nil { @@ -387,7 +387,7 @@ func getImageID(resp map[string]string) string { return dgst } -func runBasicBuild(ctx context.Context, dockerCli command.Cli, opts *controllerapi.BuildOptions, options buildOptions, printer *progress.Printer) (*client.SolveResponse, error) { +func runBasicBuild(ctx context.Context, dockerCli command.Cli, opts *controllerapi.BuildOptions, printer *progress.Printer) (*client.SolveResponse, error) { resp, res, err := cbuild.RunBuild(ctx, dockerCli, *opts, dockerCli.In(), printer, false) if res != nil { res.Done() diff --git a/commands/install.go b/commands/install.go index 9c400dfe..0014a52a 100644 --- a/commands/install.go +++ b/commands/install.go @@ -15,7 +15,7 @@ import ( type installOptions struct { } -func runInstall(dockerCli command.Cli, in installOptions) error { +func runInstall(_ command.Cli, _ installOptions) error { dir := config.Dir() if err := os.MkdirAll(dir, 0755); err != nil { return errors.Wrap(err, "could not create docker config") diff --git a/commands/uninstall.go b/commands/uninstall.go index 6bc6bf33..373a822e 100644 --- a/commands/uninstall.go +++ b/commands/uninstall.go @@ -15,7 +15,7 @@ import ( type uninstallOptions struct { } -func runUninstall(dockerCli command.Cli, in uninstallOptions) error { +func runUninstall(_ command.Cli, _ uninstallOptions) error { dir := config.Dir() cfg, err := config.Load(dir) if err != nil { diff --git a/commands/version.go b/commands/version.go index b65cc4db..f98b19dc 100644 --- a/commands/version.go +++ b/commands/version.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func runVersion(dockerCli command.Cli) error { +func runVersion(_ command.Cli) error { fmt.Println(version.Package, version.Version, version.Revision) return nil } diff --git a/controller/build/build.go b/controller/build/build.go index 06096cf1..1cae9b6c 100644 --- a/controller/build/build.go +++ b/controller/build/build.go @@ -189,7 +189,7 @@ func RunBuild(ctx context.Context, dockerCli command.Cli, in controllerapi.Build return nil, nil, err } - resp, res, err := buildTargets(ctx, dockerCli, b.NodeGroup, nodes, map[string]build.Options{defaultTargetName: opts}, progress, generateResult) + resp, res, err := buildTargets(ctx, dockerCli, nodes, map[string]build.Options{defaultTargetName: opts}, progress, generateResult) err = wrapBuildError(err, false) if err != nil { // NOTE: buildTargets can return *build.ResultHandle even on error. @@ -203,7 +203,7 @@ func RunBuild(ctx context.Context, dockerCli command.Cli, in controllerapi.Build // NOTE: When an error happens during the build and this function acquires the debuggable *build.ResultHandle, // this function returns it in addition to the error (i.e. it does "return nil, res, err"). The caller can // inspect the result and debug the cause of that error. -func buildTargets(ctx context.Context, dockerCli command.Cli, ng *store.NodeGroup, nodes []builder.Node, opts map[string]build.Options, progress progress.Writer, generateResult bool) (*client.SolveResponse, *build.ResultHandle, error) { +func buildTargets(ctx context.Context, dockerCli command.Cli, nodes []builder.Node, opts map[string]build.Options, progress progress.Writer, generateResult bool) (*client.SolveResponse, *build.ResultHandle, error) { var res *build.ResultHandle var resp map[string]*client.SolveResponse var err error diff --git a/driver/docker-container/driver.go b/driver/docker-container/driver.go index d9b29a34..14248817 100644 --- a/driver/docker-container/driver.go +++ b/driver/docker-container/driver.go @@ -77,7 +77,7 @@ func (d *Driver) Bootstrap(ctx context.Context, l progress.Logger) error { return err } return sub.Wrap("starting container "+d.Name, func() error { - if err := d.start(ctx, sub); err != nil { + if err := d.start(ctx); err != nil { return err } return d.wait(ctx, sub) @@ -188,7 +188,7 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error { if err := d.copyToContainer(ctx, d.InitConfig.Files); err != nil { return err } - if err := d.start(ctx, l); err != nil { + if err := d.start(ctx); err != nil { return err } } @@ -302,7 +302,7 @@ func (d *Driver) run(ctx context.Context, cmd []string, stdout, stderr io.Writer return nil } -func (d *Driver) start(ctx context.Context, l progress.SubLogger) error { +func (d *Driver) start(ctx context.Context) error { return d.DockerAPI.ContainerStart(ctx, d.Name, container.StartOptions{}) } diff --git a/util/gitutil/path_windows.go b/util/gitutil/path_windows.go index a1a91538..d0cae36b 100644 --- a/util/gitutil/path_windows.go +++ b/util/gitutil/path_windows.go @@ -4,6 +4,6 @@ import ( "os/exec" ) -func gitPath(wd string) (string, error) { +func gitPath(_ string) (string, error) { return exec.LookPath("git.exe") } diff --git a/util/ioset/mux_test.go b/util/ioset/mux_test.go index 7aaef570..af318be1 100644 --- a/util/ioset/mux_test.go +++ b/util/ioset/mux_test.go @@ -120,14 +120,14 @@ func TestMuxIO(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - inBuf, end, in := newTestIn(t) + inBuf, end, in := newTestIn() var outBufs []*outBuf var outs []MuxOut if tt.outputsNum != len(tt.wants) { t.Fatalf("wants != outputsNum") } for i := 0; i < tt.outputsNum; i++ { - outBuf, out := newTestOut(t, i) + outBuf, out := newTestOut(i) outBufs = append(outBufs, outBuf) outs = append(outs, MuxOut{out, nil, nil}) } @@ -223,7 +223,7 @@ type inBuf struct { doneCh chan struct{} } -func newTestIn(t *testing.T) (*inBuf, Out, In) { +func newTestIn() (*inBuf, Out, In) { ti := &inBuf{ doneCh: make(chan struct{}), } @@ -262,7 +262,7 @@ type outBuf struct { doneCh chan struct{} } -func newTestOut(t *testing.T, idx int) (*outBuf, Out) { +func newTestOut(idx int) (*outBuf, Out) { to := &outBuf{ idx: idx, doneCh: make(chan struct{}), @@ -285,7 +285,7 @@ func newTestOut(t *testing.T, idx int) (*outBuf, Out) { errW.CloseWithError(err) return } - to.stdin = string(buf.Bytes()) + to.stdin = buf.String() outW.Close() errW.Close() close(to.doneCh)