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
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
"github.com/spf13/cobra"
)
// NewApplyCmd returns apply subcmd

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,14 +4,15 @@ import (
"fmt"
"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/pflag"
"github.com/urfave/cli"
"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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,13 +13,14 @@ import (
"syscall"
"text/tabwriter"
"github.com/variantdev/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/argparser"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/plugins"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/state"
"github.com/variantdev/vals"
"go.uber.org/zap"
)
// App is the main application object.
@ -920,6 +921,7 @@ func printBatches(batches [][]state.Release) 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) {
batches, err := templated.PlanReleases(opts)
if err != nil {

View File

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

View File

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

View File

@ -9,11 +9,12 @@ import (
"testing"
"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/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
)
func TestDiffWithNeeds(t *testing.T) {

View File

@ -11,11 +11,12 @@ import (
"testing"
"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/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
)
func TestLint(t *testing.T) {

View File

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

View File

@ -11,11 +11,12 @@ import (
"testing"
"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/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"github.com/variantdev/vals"
)
func TestTemplate(t *testing.T) {

View File

@ -15,22 +15,17 @@ import (
"testing"
"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/helmfile/helmfile/pkg/exectest"
"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/remote"
"github.com/helmfile/helmfile/pkg/state"
"github.com/helmfile/helmfile/pkg/testhelper"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/testutil"
)
func appWithFs(app *App, files map[string]string) *App {

View File

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

View File

@ -6,13 +6,14 @@ import (
"fmt"
"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/helmexec"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/state"
"github.com/imdario/mergo"
"github.com/variantdev/vals"
"go.uber.org/zap"
)
const (

View File

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

View File

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

View File

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

View File

@ -9,11 +9,12 @@ import (
"testing"
"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/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
"github.com/variantdev/vals"
"go.uber.org/zap"
)
type diffConfig struct {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,15 +7,15 @@ import (
"io"
"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/variantdev/vals"
"go.uber.org/zap"
"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 (
@ -221,6 +221,7 @@ func (c *StateCreator) loadBases(envValues *environment.Environment, st *HelmSta
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) {
envVals := map[string]interface{}{}
envSpec, ok := st.Environments[name]

View File

@ -6,13 +6,12 @@ import (
"reflect"
"testing"
"github.com/helmfile/helmfile/pkg/environment"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/testhelper"
"github.com/stretchr/testify/require"
"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) {

View File

@ -4,13 +4,14 @@ import (
"fmt"
"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/maputil"
"github.com/helmfile/helmfile/pkg/remote"
"github.com/helmfile/helmfile/pkg/tmpl"
"github.com/imdario/mergo"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
)
type EnvironmentValuesLoader struct {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,8 +9,9 @@ import (
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/helmfile/helmfile/pkg/envvar"
"k8s.io/apimachinery/pkg/util/rand"
"github.com/helmfile/helmfile/pkg/envvar"
)
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) {
id, err := generateValuesID(release, data)
if err != nil {
panic(err)
return nil, err
}
workDir := os.Getenv(envvar.TempDir)
@ -40,14 +41,14 @@ func tempValuesFilePath(release *ReleaseSpec, data interface{}) (*string, error)
err = os.MkdirAll(workDir, os.FileMode(0700))
}
if err != nil {
panic(err)
return nil, err
}
d := filepath.Join(workDir, id)
_, err = os.Stat(d)
if err != nil && !errors.Is(err, os.ErrNotExist) {
panic(err)
return nil, err
}
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.
// - 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.
func normalizeChart(basePath, chart string) string {
if !isLocalChart(chart) || chart[0] == '/' {

View File

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

View File

@ -4,8 +4,9 @@ import (
"fmt"
"sync"
"github.com/helmfile/helmfile/pkg/plugins"
"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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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