fix lint error

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2022-08-12 22:05:41 +08:00
parent 18942e2a2c
commit 8690d63401
72 changed files with 170 additions and 111 deletions

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewApplyCmd returns apply subcmd // NewApplyCmd returns apply subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewBuildCmd returns build subcmd // NewBuildCmd returns build subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
func NewCacheInfoSubcommand(cacheImpl *config.CacheImpl) *cobra.Command { func NewCacheInfoSubcommand(cacheImpl *config.CacheImpl) *cobra.Command {

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewChartsCmd returns charts subcmd // NewChartsCmd returns charts subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewDeleteCmd returns delete subcmd // NewDeleteCmd returns delete subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewDepsCmd returns deps subcmd // NewDepsCmd returns deps subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewDestroyCmd returns destroy subcmd // NewDestroyCmd returns destroy subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewDiffCmd returns diff subcmd // NewDiffCmd returns diff subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewFetchCmd returns diff subcmd // NewFetchCmd returns diff subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewLintCmd returns lint subcmd // NewLintCmd returns lint subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewListCmd returns list subcmd // NewListCmd returns list subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewReposCmd returns repos subcmd // NewReposCmd returns repos subcmd

View File

@ -4,14 +4,15 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/app/version"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/urfave/cli" "github.com/urfave/cli"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/app/version"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/helmexec"
) )
var logger *zap.SugaredLogger var logger *zap.SugaredLogger

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewStatusCmd returns status subcmd // NewStatusCmd returns status subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewSyncCmd returns sync subcmd // NewSyncCmd returns sync subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewTemplateCmd returm template subcmd // NewTemplateCmd returm template subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewTestCmd returns test subcmd // NewTestCmd returns test subcmd

View File

@ -3,8 +3,9 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/helmfile/helmfile/pkg/app/version"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app/version"
) )
// NewVersionCmd returns version subcmd // NewVersionCmd returns version subcmd

View File

@ -1,9 +1,10 @@
package cmd package cmd
import ( import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
) )
// NewWriteValuesCmd returns write subcmd // NewWriteValuesCmd returns write subcmd

View File

@ -4,9 +4,10 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/urfave/cli"
"github.com/helmfile/helmfile/cmd" "github.com/helmfile/helmfile/cmd"
"github.com/helmfile/helmfile/pkg/config" "github.com/helmfile/helmfile/pkg/config"
"github.com/urfave/cli"
) )
func warning(format string, v ...interface{}) { func warning(format string, v ...interface{}) {

View File

@ -13,13 +13,14 @@ import (
"syscall" "syscall"
"text/tabwriter" "text/tabwriter"
"github.com/variantdev/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/argparser" "github.com/helmfile/helmfile/pkg/argparser"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/plugins" "github.com/helmfile/helmfile/pkg/plugins"
"github.com/helmfile/helmfile/pkg/remote" "github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/state" "github.com/helmfile/helmfile/pkg/state"
"github.com/variantdev/vals"
"go.uber.org/zap"
) )
// App is the main application object. // App is the main application object.
@ -920,6 +921,7 @@ func printBatches(batches [][]state.Release) string {
return buf.String() return buf.String()
} }
// nolint: unparam
func withDAG(templated *state.HelmState, helm helmexec.Interface, logger *zap.SugaredLogger, opts state.PlanOptions, converge func(*state.HelmState, helmexec.Interface) (bool, []error)) (bool, []error) { func withDAG(templated *state.HelmState, helm helmexec.Interface, logger *zap.SugaredLogger, opts state.PlanOptions, converge func(*state.HelmState, helmexec.Interface) (bool, []error)) (bool, []error) {
batches, err := templated.PlanReleases(opts) batches, err := templated.PlanReleases(opts)
if err != nil { if err != nil {

View File

@ -9,10 +9,11 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
) )
func TestApply_3(t *testing.T) { func TestApply_3(t *testing.T) {

View File

@ -9,10 +9,11 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
) )
func TestApply_2(t *testing.T) { func TestApply_2(t *testing.T) {

View File

@ -9,11 +9,12 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
) )
func TestDiffWithNeeds(t *testing.T) { func TestDiffWithNeeds(t *testing.T) {

View File

@ -11,11 +11,12 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
) )
func TestLint(t *testing.T) { func TestLint(t *testing.T) {

View File

@ -9,10 +9,11 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
) )
func TestSync(t *testing.T) { func TestSync(t *testing.T) {

View File

@ -11,11 +11,12 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
) )
func TestTemplate(t *testing.T) { func TestTemplate(t *testing.T) {

View File

@ -15,22 +15,17 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/testutil"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/helmfile/helmfile/pkg/exectest"
"github.com/variantdev/vals" "github.com/variantdev/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/state" "github.com/helmfile/helmfile/pkg/state"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/helmfile/helmfile/pkg/testutil"
"go.uber.org/zap"
) )
func appWithFs(app *App, files map[string]string) *App { func appWithFs(app *App, files map[string]string) *App {

View File

@ -5,8 +5,9 @@ import (
"os" "os"
"testing" "testing"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/helmfile/helmfile/pkg/envvar"
) )
// TestIsExplicitSelectorInheritanceEnabled tests the isExplicitSelectorInheritanceEnabled function // TestIsExplicitSelectorInheritanceEnabled tests the isExplicitSelectorInheritanceEnabled function

View File

@ -6,13 +6,14 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"github.com/imdario/mergo"
"github.com/variantdev/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/environment" "github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/remote" "github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/state" "github.com/helmfile/helmfile/pkg/state"
"github.com/imdario/mergo"
"github.com/variantdev/vals"
"go.uber.org/zap"
) )
const ( const (

View File

@ -8,10 +8,11 @@ import (
"sync" "sync"
"testing" "testing"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
) )
func TestDestroy_2(t *testing.T) { func TestDestroy_2(t *testing.T) {

View File

@ -8,11 +8,12 @@ import (
"sync" "sync"
"testing" "testing"
"github.com/variantdev/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
"go.uber.org/zap"
) )
const ( const (

View File

@ -9,10 +9,11 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
) )
func TestDiff_2(t *testing.T) { func TestDiff_2(t *testing.T) {

View File

@ -9,11 +9,12 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/variantdev/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
"go.uber.org/zap"
) )
type diffConfig struct { type diffConfig struct {

View File

@ -1,8 +1,9 @@
package app package app
import ( import (
"github.com/helmfile/helmfile/pkg/state"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/state"
) )
type LoadOpts struct { type LoadOpts struct {

View File

@ -6,6 +6,7 @@ import (
"strings" "strings"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/environment" "github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/state" "github.com/helmfile/helmfile/pkg/state"
"github.com/helmfile/helmfile/pkg/tmpl" "github.com/helmfile/helmfile/pkg/tmpl"

View File

@ -5,15 +5,15 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/helmfile/helmfile/pkg/remote" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/state" "github.com/helmfile/helmfile/pkg/state"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"gopkg.in/yaml.v2"
) )
// nolint: unparam
func makeLoader(files map[string]string, env string) (*desiredStateLoader, *testhelper.TestFs) { func makeLoader(files map[string]string, env string) (*desiredStateLoader, *testhelper.TestFs) {
testfs := testhelper.NewTestFs(files) testfs := testhelper.NewTestFs(files)
logger := helmexec.NewLogger(os.Stdout, "debug") logger := helmexec.NewLogger(os.Stdout, "debug")

View File

@ -4,8 +4,9 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/helmfile/helmfile/pkg/state"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/helmfile/helmfile/pkg/state"
) )
// TestGetArgs tests the GetArgs function // TestGetArgs tests the GetArgs function

View File

@ -5,11 +5,12 @@ import (
"os" "os"
"strings" "strings"
"github.com/helmfile/helmfile/pkg/maputil"
"github.com/helmfile/helmfile/pkg/state"
"github.com/urfave/cli" "github.com/urfave/cli"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/term" "golang.org/x/term"
"github.com/helmfile/helmfile/pkg/maputil"
"github.com/helmfile/helmfile/pkg/state"
) )
// nolint: golint // nolint: golint

View File

@ -4,9 +4,10 @@ import (
"errors" "errors"
"os" "os"
"github.com/helmfile/helmfile/pkg/state"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/term" "golang.org/x/term"
"github.com/helmfile/helmfile/pkg/state"
) )
// GlobalOptions is the global configuration for the Helmfile CLI. // GlobalOptions is the global configuration for the Helmfile CLI.

View File

@ -1,8 +1,9 @@
package config package config
import ( import (
"github.com/helmfile/helmfile/pkg/state"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/state"
) )
// TestOptions is the options for the build command // TestOptions is the options for the build command

View File

@ -1,9 +1,10 @@
package environment package environment
import ( import (
"github.com/helmfile/helmfile/pkg/maputil"
"github.com/imdario/mergo" "github.com/imdario/mergo"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/maputil"
) )
type Environment struct { type Environment struct {

View File

@ -4,10 +4,11 @@ import (
"fmt" "fmt"
"strings" "strings"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/environment" "github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/tmpl" "github.com/helmfile/helmfile/pkg/tmpl"
"go.uber.org/zap"
) )
type Hook struct { type Hook struct {

View File

@ -5,9 +5,10 @@ import (
"io" "io"
"testing" "testing"
"github.com/helmfile/helmfile/pkg/environment"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zaptest/observer" "go.uber.org/zap/zaptest/observer"
"github.com/helmfile/helmfile/pkg/environment"
) )
type runner struct { type runner struct {

View File

@ -7,6 +7,7 @@ import (
"sync" "sync"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
) )

View File

@ -12,9 +12,10 @@ import (
"sync" "sync"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/helmfile/helmfile/pkg/envvar"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
"github.com/helmfile/helmfile/pkg/envvar"
) )
type decryptedSecret struct { type decryptedSecret struct {

View File

@ -11,11 +11,11 @@ import (
"regexp" "regexp"
"testing" "testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/google/go-cmp/cmp"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/envvar"
) )
// Mocking the command-line runner // Mocking the command-line runner

View File

@ -12,10 +12,11 @@ import (
"github.com/hashicorp/go-getter" "github.com/hashicorp/go-getter"
"github.com/hashicorp/go-getter/helper/url" "github.com/hashicorp/go-getter/helper/url"
"github.com/helmfile/helmfile/pkg/envvar"
"go.uber.org/multierr" "go.uber.org/multierr"
"go.uber.org/zap" "go.uber.org/zap"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/envvar"
) )
var disableInsecureFeatures bool var disableInsecureFeatures bool

View File

@ -7,6 +7,7 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
) )

View File

@ -9,11 +9,12 @@ import (
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
goversion "github.com/hashicorp/go-version" goversion "github.com/hashicorp/go-version"
"github.com/helmfile/helmfile/pkg/app/version"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/r3labs/diff" "github.com/r3labs/diff"
"go.uber.org/zap" "go.uber.org/zap"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/app/version"
"github.com/helmfile/helmfile/pkg/helmexec"
) )
type ChartMeta struct { type ChartMeta struct {
@ -97,6 +98,7 @@ type ResolvedDependencies struct {
deps map[string][]ResolvedChartDependency deps map[string][]ResolvedChartDependency
} }
// nolint: unparam
func (d *ResolvedDependencies) add(dep ResolvedChartDependency) error { func (d *ResolvedDependencies) add(dep ResolvedChartDependency) error {
deps := d.deps[dep.ChartName] deps := d.deps[dep.ChartName]
if deps == nil { if deps == nil {

View File

@ -7,15 +7,15 @@ import (
"io" "io"
"os" "os"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/maputil"
"github.com/imdario/mergo" "github.com/imdario/mergo"
"github.com/variantdev/vals" "github.com/variantdev/vals"
"go.uber.org/zap" "go.uber.org/zap"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/maputil"
"github.com/helmfile/helmfile/pkg/remote"
) )
const ( const (
@ -221,6 +221,7 @@ func (c *StateCreator) loadBases(envValues *environment.Environment, st *HelmSta
return layers[0], nil return layers[0], nil
} }
// nolint: unparam
func (c *StateCreator) loadEnvValues(st *HelmState, name string, failOnMissingEnv bool, ctxEnv *environment.Environment, readFile func(string) ([]byte, error), glob func(string) ([]string, error)) (*environment.Environment, error) { func (c *StateCreator) loadEnvValues(st *HelmState, name string, failOnMissingEnv bool, ctxEnv *environment.Environment, readFile func(string) ([]byte, error), glob func(string) ([]string, error)) (*environment.Environment, error) {
envVals := map[string]interface{}{} envVals := map[string]interface{}{}
envSpec, ok := st.Environments[name] envSpec, ok := st.Environments[name]

View File

@ -6,13 +6,12 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/helmfile/helmfile/pkg/environment" "github.com/stretchr/testify/require"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/testhelper"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/stretchr/testify/require" "github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/testhelper"
) )
func createFromYaml(content []byte, file string, env string, logger *zap.SugaredLogger) (*HelmState, error) { func createFromYaml(content []byte, file string, env string, logger *zap.SugaredLogger) (*HelmState, error) {

View File

@ -4,13 +4,14 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"github.com/imdario/mergo"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/environment" "github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/maputil" "github.com/helmfile/helmfile/pkg/maputil"
"github.com/helmfile/helmfile/pkg/remote" "github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/tmpl" "github.com/helmfile/helmfile/pkg/tmpl"
"github.com/imdario/mergo"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
) )
type EnvironmentValuesLoader struct { type EnvironmentValuesLoader struct {

View File

@ -6,8 +6,9 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/remote"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/remote"
) )
func newLoader() *EnvironmentValuesLoader { func newLoader() *EnvironmentValuesLoader {

View File

@ -5,9 +5,10 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/variantdev/chartify"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/remote" "github.com/helmfile/helmfile/pkg/remote"
"github.com/variantdev/chartify"
) )
type Dependency struct { type Dependency struct {
@ -16,6 +17,7 @@ type Dependency struct {
Alias string `yaml:"alias"` Alias string `yaml:"alias"`
} }
// nolint: unparam
func (st *HelmState) appendHelmXFlags(flags []string, release *ReleaseSpec) ([]string, error) { func (st *HelmState) appendHelmXFlags(flags []string, release *ReleaseSpec) ([]string, error) {
for _, adopt := range release.Adopt { for _, adopt := range release.Adopt {
flags = append(flags, "--adopt", adopt) flags = append(flags, "--adopt", adopt)

View File

@ -3,8 +3,9 @@ package state
import ( import (
"fmt" "fmt"
"github.com/helmfile/helmfile/pkg/tmpl"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/tmpl"
) )
func (r ReleaseSpec) ExecuteTemplateExpressions(renderer *tmpl.FileRenderer) (*ReleaseSpec, error) { func (r ReleaseSpec) ExecuteTemplateExpressions(renderer *tmpl.FileRenderer) (*ReleaseSpec, error) {

View File

@ -18,18 +18,17 @@ import (
"text/template" "text/template"
"github.com/imdario/mergo" "github.com/imdario/mergo"
"github.com/tatsushid/go-prettytable"
"github.com/variantdev/chartify" "github.com/variantdev/chartify"
"github.com/variantdev/vals"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/environment" "github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/event" "github.com/helmfile/helmfile/pkg/event"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/remote" "github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/tmpl" "github.com/helmfile/helmfile/pkg/tmpl"
"github.com/tatsushid/go-prettytable"
"github.com/variantdev/vals"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
) )
const ( const (
@ -1301,6 +1300,7 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
return temp, nil return temp, nil
} }
// nolint: unparam
func (st *HelmState) runHelmDepBuilds(helm helmexec.Interface, concurrency int, builds []*chartPrepareResult) error { func (st *HelmState) runHelmDepBuilds(helm helmexec.Interface, concurrency int, builds []*chartPrepareResult) error {
// NOTES: // NOTES:
// 1. `helm dep build` fails when it was run concurrency on the same chart. // 1. `helm dep build` fails when it was run concurrency on the same chart.

View File

@ -4,8 +4,9 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"github.com/helmfile/helmfile/pkg/tmpl"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/helmfile/helmfile/pkg/tmpl"
) )
func (st *HelmState) Values() map[string]interface{} { func (st *HelmState) Values() map[string]interface{} {

View File

@ -7,6 +7,7 @@ import (
"testing" "testing"
"github.com/go-test/deep" "github.com/go-test/deep"
"github.com/helmfile/helmfile/pkg/environment" "github.com/helmfile/helmfile/pkg/environment"
) )

View File

@ -6,6 +6,7 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
) )

View File

@ -7,8 +7,9 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/variantdev/dag/pkg/dag" "github.com/variantdev/dag/pkg/dag"
"github.com/helmfile/helmfile/pkg/helmexec"
) )
type result struct { type result struct {
@ -55,6 +56,7 @@ func (st *HelmState) scatterGatherReleases(helm helmexec.Interface, concurrency
return st.iterateOnReleases(helm, concurrency, st.Releases, do) return st.iterateOnReleases(helm, concurrency, st.Releases, do)
} }
// nolint: unparam
func (st *HelmState) iterateOnReleases(helm helmexec.Interface, concurrency int, inputs []ReleaseSpec, func (st *HelmState) iterateOnReleases(helm helmexec.Interface, concurrency int, inputs []ReleaseSpec,
do func(ReleaseSpec, int) error) []error { do func(ReleaseSpec, int) error) []error {
var errs []error var errs []error

View File

@ -8,10 +8,11 @@ import (
"testing" "testing"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/exectest" "github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper" "github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
) )
var logger = helmexec.NewLogger(os.Stdout, "warn") var logger = helmexec.NewLogger(os.Stdout, "warn")
@ -1841,6 +1842,7 @@ func TestHelmState_UpdateDeps(t *testing.T) {
if err != nil { if err != nil {
return "", err return "", err
} }
// nolint: unparam
helm.UpdateDepsCallbacks[generatedDir] = func(chart string) error { helm.UpdateDepsCallbacks[generatedDir] = func(chart string) error {
content := []byte(`dependencies: content := []byte(`dependencies:
- name: envoy - name: envoy

View File

@ -9,8 +9,9 @@ import (
"strings" "strings"
"github.com/davecgh/go-spew/spew" "github.com/davecgh/go-spew/spew"
"github.com/helmfile/helmfile/pkg/envvar"
"k8s.io/apimachinery/pkg/util/rand" "k8s.io/apimachinery/pkg/util/rand"
"github.com/helmfile/helmfile/pkg/envvar"
) )
func createTempValuesFile(release *ReleaseSpec, data interface{}) (*os.File, error) { func createTempValuesFile(release *ReleaseSpec, data interface{}) (*os.File, error) {
@ -30,7 +31,7 @@ func createTempValuesFile(release *ReleaseSpec, data interface{}) (*os.File, err
func tempValuesFilePath(release *ReleaseSpec, data interface{}) (*string, error) { func tempValuesFilePath(release *ReleaseSpec, data interface{}) (*string, error) {
id, err := generateValuesID(release, data) id, err := generateValuesID(release, data)
if err != nil { if err != nil {
panic(err) return nil, err
} }
workDir := os.Getenv(envvar.TempDir) workDir := os.Getenv(envvar.TempDir)
@ -40,14 +41,14 @@ func tempValuesFilePath(release *ReleaseSpec, data interface{}) (*string, error)
err = os.MkdirAll(workDir, os.FileMode(0700)) err = os.MkdirAll(workDir, os.FileMode(0700))
} }
if err != nil { if err != nil {
panic(err) return nil, err
} }
d := filepath.Join(workDir, id) d := filepath.Join(workDir, id)
_, err = os.Stat(d) _, err = os.Stat(d)
if err != nil && !errors.Is(err, os.ErrNotExist) { if err != nil && !errors.Is(err, os.ErrNotExist) {
panic(err) return nil, err
} }
return &d, nil return &d, nil

View File

@ -48,7 +48,7 @@ func resolveRemoteChart(repoAndChart string) (string, string, bool) {
// normalizeChart allows for the distinction between a file path reference and repository references. // normalizeChart allows for the distinction between a file path reference and repository references.
// - Any single (or double character) followed by a `/` will be considered a local file reference and // - Any single (or double character) followed by a `/` will be considered a local file reference and
// be constructed relative to the `base path`. // be constructed relative to the `base path`.
// - Everything else is assumed to be an absolute path or an actual <repository>/<chart> reference. // - Everything else is assumed to be an absolute path or an actual <repository>/<chart> reference.
func normalizeChart(basePath, chart string) string { func normalizeChart(basePath, chart string) string {
if !isLocalChart(chart) || chart[0] == '/' { if !isLocalChart(chart) || chart[0] == '/' {

View File

@ -14,9 +14,10 @@ import (
"text/template" "text/template"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"golang.org/x/sync/errgroup"
"github.com/helmfile/helmfile/pkg/envvar" "github.com/helmfile/helmfile/pkg/envvar"
"github.com/helmfile/helmfile/pkg/helmexec" "github.com/helmfile/helmfile/pkg/helmexec"
"golang.org/x/sync/errgroup"
) )
type Values = map[string]interface{} type Values = map[string]interface{}

View File

@ -4,8 +4,9 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/helmfile/helmfile/pkg/plugins"
"github.com/variantdev/vals" "github.com/variantdev/vals"
"github.com/helmfile/helmfile/pkg/plugins"
) )
// to generate mock run mockgen -source=expand_secret_ref.go -destination=expand_secrets_mock.go -package=tmpl // to generate mock run mockgen -source=expand_secret_ref.go -destination=expand_secrets_mock.go -package=tmpl

View File

@ -2,11 +2,10 @@ package tmpl
import ( import (
"errors" "errors"
"testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing"
) )
func Test_fetchSecretValue(t *testing.T) { func Test_fetchSecretValue(t *testing.T) {

View File

@ -4,8 +4,9 @@
package tmpl package tmpl
import ( import (
gomock "github.com/golang/mock/gomock"
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock"
) )
// MockvalClient is a mock of valClient interface // MockvalClient is a mock of valClient interface

View File

@ -2,9 +2,8 @@ package tmpl
import ( import (
"bytes" "bytes"
"os"
"fmt" "fmt"
"os"
"strings" "strings"
) )

View File

@ -137,6 +137,7 @@ type meta struct {
namespace string namespace string
} }
// nolint: unparam
func (res resource) getMeta() (meta, error) { func (res resource) getMeta() (meta, error) {
if len(res) == 0 { if len(res) == 0 {
return meta{}, nil return meta{}, nil

View File

@ -6,8 +6,9 @@ import (
"testing" "testing"
"text/template" "text/template"
"github.com/helmfile/helmfile/pkg/tmpl"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/helmfile/helmfile/pkg/tmpl"
) )
type tmplTestCase struct { type tmplTestCase struct {

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"strings" "strings"
"github.com/jessevdk/go-flags" "github.com/jessevdk/go-flags"