diff --git a/.golangci.yml b/.golangci.yml index c6c3c3c2b..b8ed91bc4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 @@ -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 @@ -82,7 +85,6 @@ linters: - gofmt - gofumpt - goimports - - gomnd - goprintffuncname - gosec - gosimple @@ -91,6 +93,7 @@ linters: - lll - makezero - misspell + - mnd - nakedret - nestif - noctx diff --git a/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go b/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go index 42573b6f1..072a1f117 100644 --- a/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go +++ b/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go @@ -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 ( diff --git a/cmd/konvoy-image-wrapper/cmd/wrapper.go b/cmd/konvoy-image-wrapper/cmd/wrapper.go index 5ba413501..c93bb93de 100644 --- a/cmd/konvoy-image-wrapper/cmd/wrapper.go +++ b/cmd/konvoy-image-wrapper/cmd/wrapper.go @@ -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" diff --git a/cmd/konvoy-image/cmd/aws.go b/cmd/konvoy-image/cmd/aws.go index 284a36ca7..7ea20a69b 100644 --- a/cmd/konvoy-image/cmd/aws.go +++ b/cmd/konvoy-image/cmd/aws.go @@ -4,6 +4,7 @@ package cmd import ( "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/mesosphere/konvoy-image-builder/pkg/app" diff --git a/cmd/konvoy-image/cmd/azure.go b/cmd/konvoy-image/cmd/azure.go index 1abc25125..360dcd8ae 100644 --- a/cmd/konvoy-image/cmd/azure.go +++ b/cmd/konvoy-image/cmd/azure.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/mesosphere/konvoy-image-builder/pkg/app" diff --git a/cmd/konvoy-image/cmd/build.go b/cmd/konvoy-image/cmd/build.go index 5451f9e1f..a7f0012b0 100644 --- a/cmd/konvoy-image/cmd/build.go +++ b/cmd/konvoy-image/cmd/build.go @@ -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" diff --git a/cmd/konvoy-image/cmd/gcp.go b/cmd/konvoy-image/cmd/gcp.go index 61ff66a73..0ebb02c61 100644 --- a/cmd/konvoy-image/cmd/gcp.go +++ b/cmd/konvoy-image/cmd/gcp.go @@ -5,6 +5,7 @@ import ( "os" "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/mesosphere/konvoy-image-builder/pkg/app" diff --git a/cmd/konvoy-image/cmd/generate.go b/cmd/konvoy-image/cmd/generate.go index 861d966fe..5c8c328b3 100644 --- a/cmd/konvoy-image/cmd/generate.go +++ b/cmd/konvoy-image/cmd/generate.go @@ -2,6 +2,7 @@ package cmd import ( "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/mesosphere/konvoy-image-builder/pkg/app" diff --git a/cmd/konvoy-image/cmd/provision.go b/cmd/konvoy-image/cmd/provision.go index 55665d2dd..381cff6dc 100644 --- a/cmd/konvoy-image/cmd/provision.go +++ b/cmd/konvoy-image/cmd/provision.go @@ -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" ) diff --git a/cmd/konvoy-image/cmd/vsphere.go b/cmd/konvoy-image/cmd/vsphere.go index 66c7ce327..a885094c6 100644 --- a/cmd/konvoy-image/cmd/vsphere.go +++ b/cmd/konvoy-image/cmd/vsphere.go @@ -2,6 +2,7 @@ package cmd import ( "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/mesosphere/konvoy-image-builder/pkg/app" diff --git a/pkg/app/utils.go b/pkg/app/utils.go index 9693725e1..e26c2b85a 100644 --- a/pkg/app/utils.go +++ b/pkg/app/utils.go @@ -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] diff --git a/pkg/logging/logger.go b/pkg/logging/logger.go index eb50fa472..a37623056 100644 --- a/pkg/logging/logger.go +++ b/pkg/logging/logger.go @@ -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.