Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Christensen <kimworking@gmail.com>
  • Loading branch information
kichristensen committed Nov 15, 2024
1 parent 5810092 commit 5cbb0ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/plugins/pluggable/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (c *PluginConnection) collectPluginLogs(ctx context.Context) {

switch pluginLog["@level"] {
case "error":
_ = span.Error(fmt.Errorf(msg))
_ = span.Error(fmt.Errorf("%s", msg))
case "warn":
span.Warn(msg)
case "info":
Expand Down
10 changes: 5 additions & 5 deletions pkg/storage/plugins/mongodb_docker/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func EnsureMongoIsRunning(ctx context.Context, c *portercontext.Context, contain
err = exec.Command("docker", "volume", "create", dataVol).Run()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf(string(exitErr.Stderr))
err = fmt.Errorf("%s", string(exitErr.Stderr))
}
return nil, span.Error(fmt.Errorf("error creating %s docker volume: %w", dataVol, err))
}
Expand All @@ -170,7 +170,7 @@ func EnsureMongoIsRunning(ctx context.Context, c *portercontext.Context, contain
err := exec.Command("docker", "pull", mongoImg).Run()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf(string(exitErr.Stderr))
err = fmt.Errorf("%s", string(exitErr.Stderr))
}
return span.Error(fmt.Errorf("error pulling %s: %w", mongoImg, err))
}
Expand All @@ -186,7 +186,7 @@ func EnsureMongoIsRunning(ctx context.Context, c *portercontext.Context, contain
err = mongoC.Start()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf(string(exitErr.Stderr))
err = fmt.Errorf("%s", string(exitErr.Stderr))
}
return span.Error(fmt.Errorf("error running a mongo container for the mongodb-docker plugin: %w", err))
}
Expand All @@ -200,15 +200,15 @@ func EnsureMongoIsRunning(ctx context.Context, c *portercontext.Context, contain
}
} else {
if exitErr, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf(string(exitErr.Stderr))
err = fmt.Errorf("%s", string(exitErr.Stderr))
}
return nil, span.Error(fmt.Errorf("error inspecting container %s: %w", container, err))
}
} else if !strings.Contains(string(containerStatus), `"Status": "running"`) { // Container is stopped
err = exec.Command("docker", "rm", "-f", container).Run()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf(string(exitErr.Stderr))
err = fmt.Errorf("%s", string(exitErr.Stderr))
}
return nil, span.Error(fmt.Errorf("error cleaning up stopped container %s: %w", container, err))
}
Expand Down

0 comments on commit 5cbb0ca

Please sign in to comment.