Skip to content

Commit

Permalink
chore: fix linting
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Centanni <[email protected]>
  • Loading branch information
lizardruss committed Sep 18, 2024
1 parent 81dd651 commit c05afea
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion cmd/cleanup/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cleanup

import (
"context"

"github.com/loft-sh/devspace/pkg/devspace/docker"

"github.com/loft-sh/devspace/cmd/flags"
Expand Down Expand Up @@ -76,7 +77,7 @@ func (cmd *imagesCmd) RunCleanupImages(f factory.Factory, cobraCmd *cobra.Comman
}

config := configInterface.Config()
if config.Images == nil || len(config.Images) == 0 {
if len(config.Images) == 0 {
log.Done("No images found in config to delete")
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/list/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (cmd *portsCmd) RunListPort(f factory.Factory, cobraCmd *cobra.Command, arg
config := configInterface.Config()
portForwards := make([][]string, 0)
for _, dev := range config.Dev {
if dev.Ports == nil || len(dev.Ports) == 0 {
if len(dev.Ports) == 0 {
continue
}
selector := ""
Expand Down
3 changes: 2 additions & 1 deletion cmd/list/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package list

import (
"context"

"github.com/loft-sh/devspace/cmd/flags"
"github.com/loft-sh/devspace/pkg/util/factory"
"github.com/loft-sh/devspace/pkg/util/log"
Expand Down Expand Up @@ -57,7 +58,7 @@ func (cmd *syncCmd) RunListSync(f factory.Factory, cobraCmd *cobra.Command, args
syncPaths := make([][]string, 0)

for _, dev := range config.Dev {
if dev.Sync == nil || len(dev.Sync) == 0 {
if len(dev.Sync) == 0 {
logger.Info("No sync paths are configured.")
return nil
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/devspace/build/builder/custom/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package custom

import (
"fmt"
"io"
"strings"

"github.com/loft-sh/devspace/pkg/devspace/config/loader/variable/runtime"
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
"github.com/loft-sh/devspace/pkg/devspace/pipeline/engine"
"github.com/sirupsen/logrus"
"io"
"strings"

"github.com/bmatcuk/doublestar"
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
Expand Down Expand Up @@ -40,7 +41,7 @@ func NewBuilder(imageConf *latest.Image, imageTags []string) *Builder {

// ShouldRebuild implements interface
func (b *Builder) ShouldRebuild(ctx devspacecontext.Context, forceRebuild bool) (bool, error) {
if b.imageConf.Custom.OnChange == nil || len(b.imageConf.Custom.OnChange) == 0 {
if len(b.imageConf.Custom.OnChange) == 0 {
return true, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/devspace/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *controller) Deploy(ctx devspacecontext.Context, deployments []string, o
return nil
}

if config.Deployments != nil && len(config.Deployments) > 0 {
if len(config.Deployments) > 0 {
// Execute before deployments deploy hook
err := hook.ExecuteHooks(ctx, nil, "before:"+event)
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions pkg/devspace/hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package hook
import (
"bytes"
"fmt"
"io"
"strings"
"time"

"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
"github.com/loft-sh/devspace/pkg/devspace/plugin"
Expand All @@ -13,10 +17,7 @@ import (
dockerterm "github.com/moby/term"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"io"
"k8s.io/apimachinery/pkg/labels"
"strings"
"time"
)

var (
Expand Down Expand Up @@ -105,7 +106,7 @@ func executeSingle(ctx devspacecontext.Context, extraEnv map[string]string, even
}

c := config.Config()
if c.Hooks != nil && len(c.Hooks) > 0 {
if len(c.Hooks) > 0 {
hooksToExecute := []*latest.HookConfig{}

// Gather all hooks we should execute
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/log/file_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (f *fileLogger) Debugf(format string, args ...interface{}) {
return
}

f.logger.Debugf(f.addPrefixes(stripEscapeSequences(fmt.Sprintf(format, args...))))
f.logger.Debug(f.addPrefixes(stripEscapeSequences(fmt.Sprintf(format, args...))))
}

func (f *fileLogger) Info(args ...interface{}) {
Expand Down

0 comments on commit c05afea

Please sign in to comment.