mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 06:30:37 +02:00
feat: update go version and adjust dependencies in Dockerfile and go.mod (#1722)
* feat: update go version and adjust dependencies in Dockerfile and go.mod Signed-off-by: yxxhero <aiopsclub@163.com> * fix lint Signed-off-by: yxxhero <aiopsclub@163.com> * fix lint Signed-off-by: yxxhero <aiopsclub@163.com> --------- Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
+4
-4
@@ -1006,14 +1006,14 @@ func printBatches(batches [][]state.Release) string {
|
||||
|
||||
w.Init(buf, 0, 1, 1, ' ', 0)
|
||||
|
||||
fmt.Fprintln(w, "GROUP\tRELEASES")
|
||||
_, _ = fmt.Fprintln(w, "GROUP\tRELEASES")
|
||||
|
||||
for i, batch := range batches {
|
||||
ids := []string{}
|
||||
for _, r := range batch {
|
||||
ids = append(ids, state.ReleaseToID(&r.ReleaseSpec))
|
||||
}
|
||||
fmt.Fprintf(w, "%d\t%s\n", i+1, strings.Join(ids, ", "))
|
||||
_, _ = fmt.Fprintf(w, "%d\t%s\n", i+1, strings.Join(ids, ", "))
|
||||
}
|
||||
|
||||
_ = w.Flush()
|
||||
@@ -1028,13 +1028,13 @@ func printDAG(batches [][]state.Release) string {
|
||||
|
||||
w.Init(buf, 0, 1, 1, ' ', 0)
|
||||
|
||||
fmt.Fprintln(w, "GROUP\tRELEASE\tDEPENDENCIES")
|
||||
_, _ = fmt.Fprintln(w, "GROUP\tRELEASE\tDEPENDENCIES")
|
||||
|
||||
for i, batch := range batches {
|
||||
for _, r := range batch {
|
||||
id := state.ReleaseToID(&r.ReleaseSpec)
|
||||
needs := r.ReleaseSpec.Needs
|
||||
fmt.Fprintf(w, "%d\t%s\t%s\n", i+1, id, strings.Join(needs, ", "))
|
||||
_, _ = fmt.Fprintf(w, "%d\t%s\t%s\n", i+1, id, strings.Join(needs, ", "))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,12 +85,12 @@ func HandleExitCoder(err error) {
|
||||
|
||||
if exitErr, ok := err.(ExitCoder); ok {
|
||||
if errMsg := err.Error(); errMsg != "" {
|
||||
fmt.Fprintln(ErrWriter, errMsg)
|
||||
_, _ = fmt.Fprintln(ErrWriter, errMsg)
|
||||
}
|
||||
OsExiter(exitErr.ExitCode())
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprintln(ErrWriter, err)
|
||||
_, _ = fmt.Fprintln(ErrWriter, err)
|
||||
OsExiter(3)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestHCL_localsTraversalsParser(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func TestHCL_localsTraversalsAttrParser(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
func TestHCL_valuesTraversalsParser(t *testing.T) {
|
||||
@@ -105,7 +105,7 @@ func TestHCL_valuesTraversalsParser(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ func TestHCL_valuesTraversalsAttrParser(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +158,6 @@ func TestHCL_resultValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ func (helm *execer) TemplateRelease(name string, chart string, flags ...string)
|
||||
func (helm *execer) DiffRelease(context HelmContext, name, chart, namespace string, suppressDiff bool, flags ...string) error {
|
||||
diffMsg := fmt.Sprintf("Comparing release=%v, chart=%v, namespace=%v\n", name, redactedURL(chart), namespace)
|
||||
if context.Writer != nil && !suppressDiff {
|
||||
fmt.Fprint(context.Writer, diffMsg)
|
||||
_, _ = fmt.Fprint(context.Writer, diffMsg)
|
||||
} else {
|
||||
helm.logger.Info(diffMsg)
|
||||
}
|
||||
@@ -637,7 +637,7 @@ func (helm *execer) write(w io.Writer, out []byte) {
|
||||
if w == nil {
|
||||
w = os.Stdout
|
||||
}
|
||||
fmt.Fprintf(w, "%s\n", out)
|
||||
_, _ = fmt.Fprintf(w, "%s\n", out)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -997,7 +997,7 @@ func Test_GetPluginVersion(t *testing.T) {
|
||||
|
||||
v3SecretPluginVersion, err := GetPluginVersion("secrets", v3PluginDirPath)
|
||||
if err != nil {
|
||||
t.Errorf(err.Error())
|
||||
t.Error(err.Error())
|
||||
}
|
||||
if v3SecretPluginVersion.String() != v3ExpectedVersion {
|
||||
t.Errorf("secrets v3 plugin version is %v, expected %v", v3SecretPluginVersion.String(), v3ExpectedVersion)
|
||||
@@ -1005,7 +1005,7 @@ func Test_GetPluginVersion(t *testing.T) {
|
||||
|
||||
v4SecretPluginVersion, err := GetPluginVersion("secrets", v4PluginDirPath)
|
||||
if err != nil {
|
||||
t.Errorf(err.Error())
|
||||
t.Error(err.Error())
|
||||
}
|
||||
if v4SecretPluginVersion.String() != v4ExpectedVersion {
|
||||
t.Errorf("secrets v4 plugin version is %v, expected %v", v4SecretPluginVersion.String(), v4ExpectedVersion)
|
||||
|
||||
@@ -146,7 +146,7 @@ func LiveOutput(ctx context.Context, c *exec.Cmd, stripArgsValuesOnExitError boo
|
||||
}
|
||||
|
||||
line = strings.TrimSuffix(line, "\n")
|
||||
fmt.Fprintln(stdout, line)
|
||||
_, _ = fmt.Fprintln(stdout, line)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ func TestEnvValsLoad_SingleValuesFile(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestEnvValsLoad_EnvironmentNameFile(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(tt.expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -113,7 +113,7 @@ func TestEnvValsLoad_SingleValuesFileRemote(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ func TestEnvValsLoad_OverwriteNilValue_Issue1150(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ func TestEnvValsLoad_OverwriteWithNilValue_Issue1154(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ func TestEnvValsLoad_OverwriteEmptyValue_Issue1168(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,6 @@ func TestEnvValsLoad_MultiHCL(t *testing.T) {
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(expected, actual); diff != "" {
|
||||
t.Errorf(diff)
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1928,7 +1928,7 @@ func (st *HelmState) prepareDiffReleases(helm helmexec.Interface, additionalValu
|
||||
func() {
|
||||
for i := 0; i < numReleases; i++ {
|
||||
res := <-results
|
||||
if res.errors != nil && len(res.errors) > 0 {
|
||||
if len(res.errors) > 0 {
|
||||
for _, e := range res.errors {
|
||||
errs = append(errs, e)
|
||||
}
|
||||
@@ -3386,7 +3386,7 @@ func hideChartCredentials(chartCredentials string) (string, error) {
|
||||
|
||||
// DisplayAffectedReleases logs the upgraded, deleted and in error releases
|
||||
func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) {
|
||||
if ar.Upgraded != nil && len(ar.Upgraded) > 0 {
|
||||
if len(ar.Upgraded) > 0 {
|
||||
logger.Info("\nUPDATED RELEASES:")
|
||||
tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"},
|
||||
prettytable.Column{Header: "NAMESPACE", MinWidth: 6},
|
||||
@@ -3408,7 +3408,7 @@ func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) {
|
||||
}
|
||||
logger.Info(tbl.String())
|
||||
}
|
||||
if ar.Deleted != nil && len(ar.Deleted) > 0 {
|
||||
if len(ar.Deleted) > 0 {
|
||||
logger.Info("\nDELETED RELEASES:")
|
||||
tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"},
|
||||
prettytable.Column{Header: "NAMESPACE", MinWidth: 6},
|
||||
@@ -3423,7 +3423,7 @@ func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) {
|
||||
}
|
||||
logger.Info(tbl.String())
|
||||
}
|
||||
if ar.Failed != nil && len(ar.Failed) > 0 {
|
||||
if len(ar.Failed) > 0 {
|
||||
logger.Info("\nFAILED RELEASES:")
|
||||
tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"},
|
||||
prettytable.Column{Header: "NAMESPACE", MinWidth: 6},
|
||||
|
||||
@@ -391,9 +391,11 @@ func RequiredEnv(name string) (string, error) {
|
||||
|
||||
func Required(warn string, val any) (any, error) {
|
||||
if val == nil {
|
||||
// nolint:govet,staticcheck
|
||||
return nil, fmt.Errorf(warn)
|
||||
} else if _, ok := val.(string); ok {
|
||||
if val == "" {
|
||||
// nolint:govet,staticcheck
|
||||
return nil, fmt.Errorf(warn)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user