Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborszakacs committed Dec 16, 2024
1 parent 7db8e1f commit 68e241f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cli/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func cleanupDirs(dirs []string) error {
if err := os.RemoveAll(absPath); err != nil {
return fmt.Errorf("cleaning up %s: %w", dir, err)
}
log.Donef("- Cleaned %s", colorstring.Cyan(expandedPath))
log.Donef("- Cleaned %s", colorstring.Cyan("%s", expandedPath))
}

return nil
Expand Down
19 changes: 10 additions & 9 deletions cli/docker/container_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"sync"
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"

"github.com/bitrise-io/bitrise/log"
"github.com/bitrise-io/bitrise/models"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/v2/redactwriter"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
)

type RunningContainer struct {
Expand Down Expand Up @@ -267,7 +268,7 @@ func (cm *ContainerManager) login(container models.Container, envs map[string]st

out, err := command.New("docker", args...).RunAndReturnTrimmedCombinedOutput()
if err != nil {
cm.logger.Errorf(out)
cm.logger.Errorf("%s", out)
return fmt.Errorf("run docker login: %w", err)
}
}
Expand Down Expand Up @@ -328,7 +329,7 @@ func (cm *ContainerManager) startContainer(options containerCreateOptions) (*Run
cm.logger.Infof("ℹ️ Running command: docker start %s", options.name)
out, err := command.New("docker", "start", options.name).RunAndReturnTrimmedCombinedOutput()
if err != nil {
cm.logger.Errorf(out)
cm.logger.Errorf("%s", out)
return runningContainer, fmt.Errorf("start docker container (%s): %w", options.name, err)
}

Expand All @@ -349,7 +350,8 @@ func (cm *ContainerManager) createContainer(
options containerCreateOptions,
envs map[string]string,
) error {
dockerRunArgs := []string{"create",
dockerRunArgs := []string{
"create",
"--platform", "linux/amd64",
fmt.Sprintf("--network=%s", bitriseNetwork),
}
Expand Down Expand Up @@ -406,7 +408,7 @@ func (cm *ContainerManager) createContainer(

out, err := command.New("docker", dockerRunArgs...).RunAndReturnTrimmedCombinedOutput()
if err != nil {
cm.logger.Errorf(out)
cm.logger.Errorf("%s", out)
return fmt.Errorf("create container (%s): %w", options.name, err)
}

Expand Down Expand Up @@ -460,7 +462,7 @@ func (cm *ContainerManager) pullImage(container models.Container) error {
cm.logger.Infof("ℹ️ Running command: docker %s", strings.Join(dockerRunArgs, " "))
out, err := command.New("docker", dockerRunArgs...).RunAndReturnTrimmedCombinedOutput()
if err != nil {
cm.logger.Errorf(out)
cm.logger.Errorf("%s", out)
return fmt.Errorf("pull container (%s): %w", container.Image, err)
}
return nil
Expand Down Expand Up @@ -495,7 +497,6 @@ func (cm *ContainerManager) getRunningContainer(ctx context.Context, name string
return &containers[0], fmt.Errorf("container (%s) is not running", name)
}
return &containers[0], nil

}

func (cm *ContainerManager) healthCheckContainer(ctx context.Context, container *RunningContainer) error {
Expand Down
6 changes: 3 additions & 3 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ func (m *defaultLogger) PrintBitriseStartedEvent(plan models.WorkflowRunPlan) {
})
} else {
m.Print()
m.Printf("Invocation started at %s", colorstring.Cyan(m.opts.TimeProvider().Format(consoleTimeLayout)))
m.Printf("Bitrise CLI version: %s", colorstring.Cyan(plan.Version))
m.Printf("Invocation started at %s", colorstring.Cyan("%s", m.opts.TimeProvider().Format(consoleTimeLayout)))
m.Printf("Bitrise CLI version: %s", colorstring.Cyan("%s", plan.Version))
m.Print()
m.Infof("Run modes:")
m.Printf("CI mode: %v", colorstring.Cyan("%v", plan.CIMode))
Expand All @@ -169,7 +169,7 @@ func (m *defaultLogger) PrintBitriseStartedEvent(plan models.WorkflowRunPlan) {
prefix = "Running workflows"
}

m.Printf("%s: %s", prefix, colorstring.Cyan(strings.Join(workflowIDs, " → ")))
m.Printf("%s: %s", prefix, colorstring.Cyan("%s", strings.Join(workflowIDs, " → ")))
}
}

Expand Down
4 changes: 2 additions & 2 deletions models/models_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ func removeEnvironmentRedundantFields(env *envmanModels.EnvironmentItemModel) er
hasOptions = true
}
}
if options.ValueOptions != nil && len(options.ValueOptions) > 0 {
if len(options.ValueOptions) > 0 {
hasOptions = true
}
if options.IsRequired != nil {
Expand All @@ -929,7 +929,7 @@ func removeEnvironmentRedundantFields(env *envmanModels.EnvironmentItemModel) er
hasOptions = true
}
}
if options.Meta != nil && len(options.Meta) > 0 {
if len(options.Meta) > 0 {
hasOptions = true
}

Expand Down

0 comments on commit 68e241f

Please sign in to comment.