mirror of
				https://github.com/fluxcd/flux2.git
				synced 2025-10-31 16:26:36 +08:00 
			
		
		
		
	misc: address strings.Title deprecation
				
					
				
			Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
		| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" | 	notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" | ||||||
| @ -77,7 +78,8 @@ func init() { | |||||||
| func (s alertListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string { | func (s alertListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string { | ||||||
| 	item := s.Items[i] | 	item := s.Items[i] | ||||||
| 	status, msg := statusAndMessage(item.Status.Conditions) | 	status, msg := statusAndMessage(item.Status.Conditions) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
|  | 		cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s alertListAdapter) headers(includeNamespace bool) []string { | func (s alertListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,11 +19,13 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
|  | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" | 	helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" | ||||||
| 	"github.com/spf13/cobra" |  | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var getHelmReleaseCmd = &cobra.Command{ | var getHelmReleaseCmd = &cobra.Command{ | ||||||
| @ -75,7 +77,7 @@ func (a helmReleaseListAdapter) summariseItem(i int, includeNamespace bool, incl | |||||||
| 	revision := item.Status.LastAppliedRevision | 	revision := item.Status.LastAppliedRevision | ||||||
| 	status, msg := statusAndMessage(item.Status.Conditions) | 	status, msg := statusAndMessage(item.Status.Conditions) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a helmReleaseListAdapter) headers(includeNamespace bool) []string { | func (a helmReleaseListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,10 +19,11 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" | 	imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" | ||||||
| @ -82,7 +83,7 @@ func (s imageRepositoryListAdapter) summariseItem(i int, includeNamespace bool, | |||||||
| 		lastScan = item.Status.LastScanResult.ScanTime.Time.Format(time.RFC3339) | 		lastScan = item.Status.LastScanResult.ScanTime.Time.Format(time.RFC3339) | ||||||
| 	} | 	} | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		lastScan, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		lastScan, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s imageRepositoryListAdapter) headers(includeNamespace bool) []string { | func (s imageRepositoryListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,10 +19,11 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" | 	autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" | ||||||
| @ -81,7 +82,8 @@ func (s imageUpdateAutomationListAdapter) summariseItem(i int, includeNamespace | |||||||
| 	if item.Status.LastAutomationRunTime != nil { | 	if item.Status.LastAutomationRunTime != nil { | ||||||
| 		lastRun = item.Status.LastAutomationRunTime.Time.Format(time.RFC3339) | 		lastRun = item.Status.LastAutomationRunTime.Time.Format(time.RFC3339) | ||||||
| 	} | 	} | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), lastRun, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 	return append(nameColumns(&item, includeNamespace, includeKind), lastRun, | ||||||
|  | 		cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s imageUpdateAutomationListAdapter) headers(includeNamespace bool) []string { | func (s imageUpdateAutomationListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" | 	kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" | ||||||
| @ -83,7 +84,7 @@ func (a kustomizationListAdapter) summariseItem(i int, includeNamespace bool, in | |||||||
| 	revision = utils.TruncateHex(revision) | 	revision = utils.TruncateHex(revision) | ||||||
| 	msg = utils.TruncateHex(msg) | 	msg = utils.TruncateHex(msg) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a kustomizationListAdapter) headers(includeNamespace bool) []string { | func (a kustomizationListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	notificationv1 "github.com/fluxcd/notification-controller/api/v1" | 	notificationv1 "github.com/fluxcd/notification-controller/api/v1" | ||||||
| @ -74,7 +75,8 @@ func init() { | |||||||
| func (s receiverListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string { | func (s receiverListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string { | ||||||
| 	item := s.Items[i] | 	item := s.Items[i] | ||||||
| 	status, msg := statusAndMessage(item.Status.Conditions) | 	status, msg := statusAndMessage(item.Status.Conditions) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
|  | 		cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s receiverListAdapter) headers(includeNamespace bool) []string { | func (s receiverListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | ||||||
| @ -85,7 +86,7 @@ func (a *bucketListAdapter) summariseItem(i int, includeNamespace bool, includeK | |||||||
| 	revision = utils.TruncateHex(revision) | 	revision = utils.TruncateHex(revision) | ||||||
| 	msg = utils.TruncateHex(msg) | 	msg = utils.TruncateHex(msg) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a bucketListAdapter) headers(includeNamespace bool) []string { | func (a bucketListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | ||||||
| @ -86,7 +87,7 @@ func (a *helmChartListAdapter) summariseItem(i int, includeNamespace bool, inclu | |||||||
| 	// Message may still contain reference of e.g. commit chart was build from | 	// Message may still contain reference of e.g. commit chart was build from | ||||||
| 	msg = utils.TruncateHex(msg) | 	msg = utils.TruncateHex(msg) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a helmChartListAdapter) headers(includeNamespace bool) []string { | func (a helmChartListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	sourcev1 "github.com/fluxcd/source-controller/api/v1" | 	sourcev1 "github.com/fluxcd/source-controller/api/v1" | ||||||
| @ -85,7 +86,7 @@ func (a *gitRepositoryListAdapter) summariseItem(i int, includeNamespace bool, i | |||||||
| 	revision = utils.TruncateHex(revision) | 	revision = utils.TruncateHex(revision) | ||||||
| 	msg = utils.TruncateHex(msg) | 	msg = utils.TruncateHex(msg) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a gitRepositoryListAdapter) headers(includeNamespace bool) []string { | func (a gitRepositoryListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | ||||||
| @ -85,7 +86,7 @@ func (a *helmRepositoryListAdapter) summariseItem(i int, includeNamespace bool, | |||||||
| 	revision = utils.TruncateHex(revision) | 	revision = utils.TruncateHex(revision) | ||||||
| 	msg = utils.TruncateHex(msg) | 	msg = utils.TruncateHex(msg) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a helmRepositoryListAdapter) headers(includeNamespace bool) []string { | func (a helmRepositoryListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
| @ -19,9 +19,10 @@ package main | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"golang.org/x/text/cases" | ||||||
|  | 	"golang.org/x/text/language" | ||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
|  |  | ||||||
| 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | 	sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | ||||||
| @ -85,7 +86,7 @@ func (a *ociRepositoryListAdapter) summariseItem(i int, includeNamespace bool, i | |||||||
| 	revision = utils.TruncateHex(revision) | 	revision = utils.TruncateHex(revision) | ||||||
| 	msg = utils.TruncateHex(msg) | 	msg = utils.TruncateHex(msg) | ||||||
| 	return append(nameColumns(&item, includeNamespace, includeKind), | 	return append(nameColumns(&item, includeNamespace, includeKind), | ||||||
| 		revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg) | 		revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (a ociRepositoryListAdapter) headers(includeNamespace bool) []string { | func (a ociRepositoryListAdapter) headers(includeNamespace bool) []string { | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @ -48,6 +48,7 @@ require ( | |||||||
| 	github.com/theckman/yacspin v0.13.12 | 	github.com/theckman/yacspin v0.13.12 | ||||||
| 	golang.org/x/crypto v0.14.0 | 	golang.org/x/crypto v0.14.0 | ||||||
| 	golang.org/x/term v0.13.0 | 	golang.org/x/term v0.13.0 | ||||||
|  | 	golang.org/x/text v0.13.0 | ||||||
| 	k8s.io/api v0.27.4 | 	k8s.io/api v0.27.4 | ||||||
| 	k8s.io/apiextensions-apiserver v0.27.4 | 	k8s.io/apiextensions-apiserver v0.27.4 | ||||||
| 	k8s.io/apimachinery v0.27.4 | 	k8s.io/apimachinery v0.27.4 | ||||||
| @ -195,7 +196,6 @@ require ( | |||||||
| 	golang.org/x/oauth2 v0.13.0 // indirect | 	golang.org/x/oauth2 v0.13.0 // indirect | ||||||
| 	golang.org/x/sync v0.3.0 // indirect | 	golang.org/x/sync v0.3.0 // indirect | ||||||
| 	golang.org/x/sys v0.13.0 // indirect | 	golang.org/x/sys v0.13.0 // indirect | ||||||
| 	golang.org/x/text v0.13.0 // indirect |  | ||||||
| 	golang.org/x/time v0.3.0 // indirect | 	golang.org/x/time v0.3.0 // indirect | ||||||
| 	golang.org/x/tools v0.13.0 // indirect | 	golang.org/x/tools v0.13.0 // indirect | ||||||
| 	gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect | 	gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Hidde Beydals
					Hidde Beydals