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:
yxxhero 2024-09-30 21:21:44 +08:00 committed by GitHub
parent 5963dd364d
commit b375a31f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 64 additions and 68 deletions

View File

@ -20,7 +20,7 @@ jobs:
cache: false cache: false
- uses: golangci/golangci-lint-action@v6 - uses: golangci/golangci-lint-action@v6
with: with:
version: v1.57.2 version: v1.61.0
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder
RUN apk add --no-cache make git RUN apk add --no-cache make git
WORKDIR /workspace/helmfile WORKDIR /workspace/helmfile

View File

@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder
RUN apk add --no-cache make git RUN apk add --no-cache make git
WORKDIR /workspace/helmfile WORKDIR /workspace/helmfile

View File

@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder
RUN apk add --no-cache make git RUN apk add --no-cache make git
WORKDIR /workspace/helmfile WORKDIR /workspace/helmfile

4
go.mod
View File

@ -1,6 +1,6 @@
module github.com/helmfile/helmfile module github.com/helmfile/helmfile
go 1.22.6 go 1.23.1
require ( require (
dario.cat/mergo v1.0.1 dario.cat/mergo v1.0.1
@ -184,7 +184,6 @@ require (
github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-metrics v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/extism/go-sdk v1.3.1 // indirect github.com/extism/go-sdk v1.3.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@ -233,7 +232,6 @@ require (
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/moby/locker v1.0.1 // indirect github.com/moby/locker v1.0.1 // indirect

4
go.sum
View File

@ -443,8 +443,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls=
github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/extism/go-sdk v1.3.1 h1:eVpuv36b67Km/tAb7Cq6msHEW8kkdFgpZO/7fCwjuoE= github.com/extism/go-sdk v1.3.1 h1:eVpuv36b67Km/tAb7Cq6msHEW8kkdFgpZO/7fCwjuoE=
github.com/extism/go-sdk v1.3.1/go.mod h1:tPMWfCSOThie3LSTSZKbrQjRm2oAXxUUjSE4HJWjYQM= github.com/extism/go-sdk v1.3.1/go.mod h1:tPMWfCSOThie3LSTSZKbrQjRm2oAXxUUjSE4HJWjYQM=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
@ -776,8 +774,6 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=

View File

@ -1006,14 +1006,14 @@ func printBatches(batches [][]state.Release) string {
w.Init(buf, 0, 1, 1, ' ', 0) w.Init(buf, 0, 1, 1, ' ', 0)
fmt.Fprintln(w, "GROUP\tRELEASES") _, _ = fmt.Fprintln(w, "GROUP\tRELEASES")
for i, batch := range batches { for i, batch := range batches {
ids := []string{} ids := []string{}
for _, r := range batch { for _, r := range batch {
ids = append(ids, state.ReleaseToID(&r.ReleaseSpec)) 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() _ = w.Flush()
@ -1028,13 +1028,13 @@ func printDAG(batches [][]state.Release) string {
w.Init(buf, 0, 1, 1, ' ', 0) 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 i, batch := range batches {
for _, r := range batch { for _, r := range batch {
id := state.ReleaseToID(&r.ReleaseSpec) id := state.ReleaseToID(&r.ReleaseSpec)
needs := r.ReleaseSpec.Needs 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, ", "))
} }
} }

View File

@ -85,12 +85,12 @@ func HandleExitCoder(err error) {
if exitErr, ok := err.(ExitCoder); ok { if exitErr, ok := err.(ExitCoder); ok {
if errMsg := err.Error(); errMsg != "" { if errMsg := err.Error(); errMsg != "" {
fmt.Fprintln(ErrWriter, errMsg) _, _ = fmt.Fprintln(ErrWriter, errMsg)
} }
OsExiter(exitErr.ExitCode()) OsExiter(exitErr.ExitCode())
return return
} }
fmt.Fprintln(ErrWriter, err) _, _ = fmt.Fprintln(ErrWriter, err)
OsExiter(3) OsExiter(3)
} }

View File

@ -44,7 +44,7 @@ func TestHCL_localsTraversalsParser(t *testing.T) {
} }
if diff := cmp.Diff(expected, actual); diff != "" { 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 != "" { if diff := cmp.Diff(expected, actual); diff != "" {
t.Errorf(diff) t.Error(diff)
} }
} }
func TestHCL_valuesTraversalsParser(t *testing.T) { func TestHCL_valuesTraversalsParser(t *testing.T) {
@ -105,7 +105,7 @@ func TestHCL_valuesTraversalsParser(t *testing.T) {
} }
if diff := cmp.Diff(expected, actual); diff != "" { 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 != "" { 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 != "" { if diff := cmp.Diff(expected, actual); diff != "" {
t.Errorf(diff) t.Error(diff)
} }
} }

View File

@ -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 { 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) diffMsg := fmt.Sprintf("Comparing release=%v, chart=%v, namespace=%v\n", name, redactedURL(chart), namespace)
if context.Writer != nil && !suppressDiff { if context.Writer != nil && !suppressDiff {
fmt.Fprint(context.Writer, diffMsg) _, _ = fmt.Fprint(context.Writer, diffMsg)
} else { } else {
helm.logger.Info(diffMsg) helm.logger.Info(diffMsg)
} }
@ -637,7 +637,7 @@ func (helm *execer) write(w io.Writer, out []byte) {
if w == nil { if w == nil {
w = os.Stdout w = os.Stdout
} }
fmt.Fprintf(w, "%s\n", out) _, _ = fmt.Fprintf(w, "%s\n", out)
} }
} }

View File

@ -997,7 +997,7 @@ func Test_GetPluginVersion(t *testing.T) {
v3SecretPluginVersion, err := GetPluginVersion("secrets", v3PluginDirPath) v3SecretPluginVersion, err := GetPluginVersion("secrets", v3PluginDirPath)
if err != nil { if err != nil {
t.Errorf(err.Error()) t.Error(err.Error())
} }
if v3SecretPluginVersion.String() != v3ExpectedVersion { if v3SecretPluginVersion.String() != v3ExpectedVersion {
t.Errorf("secrets v3 plugin version is %v, expected %v", 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) v4SecretPluginVersion, err := GetPluginVersion("secrets", v4PluginDirPath)
if err != nil { if err != nil {
t.Errorf(err.Error()) t.Error(err.Error())
} }
if v4SecretPluginVersion.String() != v4ExpectedVersion { if v4SecretPluginVersion.String() != v4ExpectedVersion {
t.Errorf("secrets v4 plugin version is %v, expected %v", v4SecretPluginVersion.String(), v4ExpectedVersion) t.Errorf("secrets v4 plugin version is %v, expected %v", v4SecretPluginVersion.String(), v4ExpectedVersion)

View File

@ -146,7 +146,7 @@ func LiveOutput(ctx context.Context, c *exec.Cmd, stripArgsValuesOnExitError boo
} }
line = strings.TrimSuffix(line, "\n") line = strings.TrimSuffix(line, "\n")
fmt.Fprintln(stdout, line) _, _ = fmt.Fprintln(stdout, line)
} }
}() }()

View File

@ -39,7 +39,7 @@ func TestEnvValsLoad_SingleValuesFile(t *testing.T) {
} }
if diff := cmp.Diff(expected, actual); diff != "" { 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 != "" { 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 != "" { 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 != "" { 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 != "" { 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 != "" { 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 != "" { if diff := cmp.Diff(expected, actual); diff != "" {
t.Errorf(diff) t.Error(diff)
} }
} }

View File

@ -1928,7 +1928,7 @@ func (st *HelmState) prepareDiffReleases(helm helmexec.Interface, additionalValu
func() { func() {
for i := 0; i < numReleases; i++ { for i := 0; i < numReleases; i++ {
res := <-results res := <-results
if res.errors != nil && len(res.errors) > 0 { if len(res.errors) > 0 {
for _, e := range res.errors { for _, e := range res.errors {
errs = append(errs, e) errs = append(errs, e)
} }
@ -3386,7 +3386,7 @@ func hideChartCredentials(chartCredentials string) (string, error) {
// DisplayAffectedReleases logs the upgraded, deleted and in error releases // DisplayAffectedReleases logs the upgraded, deleted and in error releases
func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) { func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) {
if ar.Upgraded != nil && len(ar.Upgraded) > 0 { if len(ar.Upgraded) > 0 {
logger.Info("\nUPDATED RELEASES:") logger.Info("\nUPDATED RELEASES:")
tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"}, tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"},
prettytable.Column{Header: "NAMESPACE", MinWidth: 6}, prettytable.Column{Header: "NAMESPACE", MinWidth: 6},
@ -3408,7 +3408,7 @@ func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) {
} }
logger.Info(tbl.String()) logger.Info(tbl.String())
} }
if ar.Deleted != nil && len(ar.Deleted) > 0 { if len(ar.Deleted) > 0 {
logger.Info("\nDELETED RELEASES:") logger.Info("\nDELETED RELEASES:")
tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"}, tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"},
prettytable.Column{Header: "NAMESPACE", MinWidth: 6}, prettytable.Column{Header: "NAMESPACE", MinWidth: 6},
@ -3423,7 +3423,7 @@ func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) {
} }
logger.Info(tbl.String()) logger.Info(tbl.String())
} }
if ar.Failed != nil && len(ar.Failed) > 0 { if len(ar.Failed) > 0 {
logger.Info("\nFAILED RELEASES:") logger.Info("\nFAILED RELEASES:")
tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"}, tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"},
prettytable.Column{Header: "NAMESPACE", MinWidth: 6}, prettytable.Column{Header: "NAMESPACE", MinWidth: 6},

View File

@ -391,9 +391,11 @@ func RequiredEnv(name string) (string, error) {
func Required(warn string, val any) (any, error) { func Required(warn string, val any) (any, error) {
if val == nil { if val == nil {
// nolint:govet,staticcheck
return nil, fmt.Errorf(warn) return nil, fmt.Errorf(warn)
} else if _, ok := val.(string); ok { } else if _, ok := val.(string); ok {
if val == "" { if val == "" {
// nolint:govet,staticcheck
return nil, fmt.Errorf(warn) return nil, fmt.Errorf(warn)
} }
} }