Skip to content

Commit

Permalink
fix: linter workflow due to golangci-lint in CI (#1075) (#1087)
Browse files Browse the repository at this point in the history
Co-authored-by: Faiq <[email protected]>
  • Loading branch information
supershal and faiq authored May 20, 2024
1 parent 469376a commit de50fa4
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 16 deletions.
25 changes: 14 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ linters-settings:
lines: 100
statements: 50
gci:
local-prefixes: github.com/mesosphere/konvoy-image-builder
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/mesosphere/konvoy-image-builder) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
goconst:
min-len: 2
min-occurrences: 2
Expand All @@ -34,16 +41,12 @@ linters-settings:
- style
gocyclo:
min-complexity: 15
gomnd:
settings:
mnd:
# don't include "argument", "operation", and "assign"
checks:
- case
- condition
- return
mnd:
checks:
- case
- condition
- return
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
Expand Down Expand Up @@ -82,7 +85,6 @@ linters:
- gofmt
- gofumpt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
Expand All @@ -91,6 +93,7 @@ linters:
- lll
- makezero
- misspell
- mnd
- nakedret
- nestif
- noctx
Expand Down
3 changes: 2 additions & 1 deletion cmd/konvoy-image-wrapper/cmd/create-package-bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import (
"text/template"

"github.com/blang/semver"
terminal "golang.org/x/term"
"gopkg.in/yaml.v2"

terminal "golang.org/x/term"
)

const (
Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image-wrapper/cmd/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

const (
envAWSConfigFile = "AWS_CONFIG_FILE"
envAWSCredentialsFile = "AWS_SHARED_CREDENTIALS_FILE" //nolint:gosec // environment var set by user

envAWSDefaultRegion = "AWS_DEFAULT_REGION"
Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image/cmd/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package cmd

import (
"github.com/spf13/cobra"

flag "github.com/spf13/pflag"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image/cmd/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"

"github.com/spf13/cobra"

flag "github.com/spf13/pflag"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
Expand Down
3 changes: 2 additions & 1 deletion cmd/konvoy-image/cmd/build.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package cmd

import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

log "github.com/sirupsen/logrus"
flag "github.com/spf13/pflag"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image/cmd/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/spf13/cobra"

flag "github.com/spf13/pflag"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/spf13/cobra"

flag "github.com/spf13/pflag"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
Expand Down
3 changes: 2 additions & 1 deletion cmd/konvoy-image/cmd/provision.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cmd

import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

log "github.com/sirupsen/logrus"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image/cmd/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/spf13/cobra"

flag "github.com/spf13/pflag"

"github.com/mesosphere/konvoy-image-builder/pkg/app"
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func addExtraVarsToMap(extraVars []string, m map[string]interface{}) error {
extraVarSet := make(map[string]interface{})
for _, extraVars := range extraVars {
set := strings.Split(extraVars, "=")
//nolint:gomnd // the code is splitting on the equal
//nolint:mnd // the code is splitting on the equal
if len(set) == 2 {
k := set[0]
v := set[1]
Expand Down
3 changes: 2 additions & 1 deletion pkg/logging/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package logging
import (
"errors"

logrustooling "github.com/onrik/logrus/filename"
"github.com/sirupsen/logrus"

logrustooling "github.com/onrik/logrus/filename"
)

// Logger is the custom global logger object.
Expand Down

0 comments on commit de50fa4

Please sign in to comment.