Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/bindata/olm/manifests.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type templObj struct {
// convertConfig3AlphaTo3 returns cfgBytes converted to 3 iff cfgBytes is version 3-alpha.
func convertConfig3AlphaTo3(cfgBytes []byte) (_ []byte, err error) {
tObj := templObj{}
cfgObj := make(map[string]interface{}, 5)
cfgObj := make(map[string]any, 5)
if err := yaml.Unmarshal(cfgBytes, &cfgObj); err != nil {
return nil, err
}
Expand Down Expand Up @@ -72,13 +72,13 @@ func convertConfig3AlphaTo3(cfgBytes []byte) (_ []byte, err error) {
domain = domainObj.(string)
}

resObjs := obj.([]interface{})
resObjs := obj.([]any)
resources := make([]resource.Resource, len(resObjs))

for i, resObj := range resObjs {
resources[i].Domain = domain

res := resObj.(map[string]interface{})
res := resObj.(map[string]any)
if groupObj, ok := res["group"]; ok {
resources[i].Group = groupObj.(string)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/operator-sdk/generate/bundle/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c *bundleCmd) addFlagsTo(fs *pflag.FlagSet) {
fs.BoolVar(&c.useImageDigests, "use-image-digests", false, "Use SHA Digest for images")
}

func (c bundleCmd) println(a ...interface{}) {
func (c bundleCmd) println(a ...any) {
if !(c.quiet || c.stdout) {
fmt.Println(a...)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/operator-sdk/generate/internal/genutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func makeObjectFileName(obj client.Object) string {
}

// writeObjectToFile marshals crd to bytes and writes them to dir in file.
func writeObjectToFile(dir string, obj interface{}, fileName string) error {
func writeObjectToFile(dir string, obj any, fileName string) error {
f, err := os.Create(filepath.Join(dir, fileName))
if err != nil {
return err
Expand All @@ -128,7 +128,7 @@ func writeObjectToFile(dir string, obj interface{}, fileName string) error {
}

// writeObject marshals crd to bytes and writes them to w.
func writeObject(w io.Writer, obj interface{}) error {
func writeObject(w io.Writer, obj any) error {
b, err := yaml.Marshal(obj)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/operator-sdk/generate/packagemanifests/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (c *packagemanifestsCmd) addFlagsTo(fs *pflag.FlagSet) {
fs.StringVar(&c.packageName, "package", "", "Package name")
}

func (c packagemanifestsCmd) println(a ...interface{}) {
func (c packagemanifestsCmd) println(a ...any) {
if !(c.quiet || c.stdout) {
fmt.Println(a...)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/operator-sdk/scorecard/xunit/xunit.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type TestSuites struct {

// Preperty is a named property that will be formatted as an XML tag.
type Property struct {
Name string `xml:"name,attr"`
Value interface{} `xml:"value,attr"`
Name string `xml:"name,attr"`
Value any `xml:"value,attr"`
}

// TestSuite contains for details about a test beyond the final status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (g generator) buildCRDDescriptionFromType(gvk schema.GroupVersionKind, type
return description, descriptionOrder, nil
}

func (g generator) getTypedDescriptors(pkg *loader.Package, kindType *markers.TypeInfo, t reflect.Type, descType string) ([]interface{}, error) {
func (g generator) getTypedDescriptors(pkg *loader.Package, kindType *markers.TypeInfo, t reflect.Type, descType string) ([]any, error) {
// Find child in the kind type.
child, err := findChildForDescType(kindType, descType)
if err != nil {
Expand All @@ -133,7 +133,7 @@ func (g generator) getTypedDescriptors(pkg *loader.Package, kindType *markers.Ty
return getTypedDescriptors(markedFields, t, descType), nil
}

func getTypedDescriptors(markedFields map[crd.TypeIdent][]*fieldInfo, t reflect.Type, descType string) (descriptors []interface{}) {
func getTypedDescriptors(markedFields map[crd.TypeIdent][]*fieldInfo, t reflect.Type, descType string) (descriptors []any) {
descriptorBuckets := make(map[int][]reflect.Value)
orders := make([]int, 0)
for _, fields := range markedFields {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
var _ = Describe("getTypedDescriptors", func() {
var (
markedFields map[crd.TypeIdent][]*fieldInfo
out []interface{}
out []any
)

BeforeEach(func() {
Expand All @@ -50,7 +50,7 @@ var _ = Describe("getTypedDescriptors", func() {
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{
"": []any{
Descriptor{"spec", "Foo", []string{"urn:alm:descriptor:com.tectonic.ui:text"}, nil},
},
},
Expand All @@ -59,7 +59,7 @@ var _ = Describe("getTypedDescriptors", func() {
}
out = getTypedDescriptors(markedFields, reflect.TypeOf(v1alpha1.SpecDescriptor{}), spec)
Expect(out).To(HaveLen(1))
Expect(out).To(BeEquivalentTo([]interface{}{
Expect(out).To(BeEquivalentTo([]any{
v1alpha1.SpecDescriptor{
DisplayName: "Foo",
XDescriptors: []string{"urn:alm:descriptor:com.tectonic.ui:text"},
Expand All @@ -71,7 +71,7 @@ var _ = Describe("getTypedDescriptors", func() {
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{
"": []any{
Descriptor{"status", "Foo", []string{"urn:alm:descriptor:com.tectonic.ui:text"}, nil},
},
},
Expand All @@ -86,7 +86,7 @@ var _ = Describe("getTypedDescriptors", func() {
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{
"": []any{
Descriptor{"status", "Foo", []string{"urn:alm:descriptor:com.tectonic.ui:text"}, nil},
},
},
Expand All @@ -95,7 +95,7 @@ var _ = Describe("getTypedDescriptors", func() {
}
out = getTypedDescriptors(markedFields, reflect.TypeOf(v1alpha1.StatusDescriptor{}), status)
Expect(out).To(HaveLen(1))
Expect(out).To(BeEquivalentTo([]interface{}{
Expect(out).To(BeEquivalentTo([]any{
v1alpha1.StatusDescriptor{
DisplayName: "Foo",
XDescriptors: []string{"urn:alm:descriptor:com.tectonic.ui:text"},
Expand All @@ -107,7 +107,7 @@ var _ = Describe("getTypedDescriptors", func() {
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{
"": []any{
Descriptor{"spec", "Foo", nil, nil},
Descriptor{"spec", "", nil, intPtr(2)},
Descriptor{"spec", "", []string{"urn:alm:descriptor:com.tectonic.ui:text"}, nil},
Expand All @@ -120,7 +120,7 @@ var _ = Describe("getTypedDescriptors", func() {
}
out = getTypedDescriptors(markedFields, reflect.TypeOf(v1alpha1.SpecDescriptor{}), spec)
Expect(out).To(HaveLen(1))
Expect(out).To(BeEquivalentTo([]interface{}{
Expect(out).To(BeEquivalentTo([]any{
v1alpha1.SpecDescriptor{
DisplayName: "Foo",
XDescriptors: []string{"urn:alm:descriptor:com.tectonic.ui:text"},
Expand All @@ -133,23 +133,23 @@ var _ = Describe("getTypedDescriptors", func() {
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{Descriptor{"spec", "Foo", nil, intPtr(1)}},
"": []any{Descriptor{"spec", "Foo", nil, intPtr(1)}},
},
},
pathSegments: []string{"foo"},
},
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{Descriptor{"spec", "Bar", nil, intPtr(0)}},
"": []any{Descriptor{"spec", "Bar", nil, intPtr(0)}},
},
},
pathSegments: []string{"bar"},
},
}
out = getTypedDescriptors(markedFields, reflect.TypeOf(v1alpha1.SpecDescriptor{}), spec)
Expect(out).To(HaveLen(2))
Expect(out).To(BeEquivalentTo([]interface{}{
Expect(out).To(BeEquivalentTo([]any{
v1alpha1.SpecDescriptor{DisplayName: "Bar", Path: "bar"},
v1alpha1.SpecDescriptor{DisplayName: "Foo", Path: "foo"},
}))
Expand All @@ -166,7 +166,7 @@ func intPtr(i int) *int { return &i }

// makeMockMarkedFields returns a randomly generated mock marked field set,
// and the expected sorted set of descriptors.
func makeMockMarkedFields() (markedFields map[crd.TypeIdent][]*fieldInfo, expected []interface{}) {
func makeMockMarkedFields() (markedFields map[crd.TypeIdent][]*fieldInfo, expected []any) {
descBuckets := make(map[int][]v1alpha1.SpecDescriptor, 100)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
markedFields = make(map[crd.TypeIdent][]*fieldInfo, 100)
Expand All @@ -186,7 +186,7 @@ func makeMockMarkedFields() (markedFields map[crd.TypeIdent][]*fieldInfo, expect
{
FieldInfo: markers.FieldInfo{
Markers: markers.MarkerValues{
"": []interface{}{Descriptor{"spec", name, nil, intPtr(order)}},
"": []any{Descriptor{"spec", name, nil, intPtr(order)}},
},
},
pathSegments: []string{s},
Expand Down
4 changes: 2 additions & 2 deletions internal/generate/internal/genutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func Open(dir, fileName string) (*File, error) {
}

// WriteObject writes a k8s object to w.
func WriteObject(w io.Writer, obj interface{}) error {
func WriteObject(w io.Writer, obj any) error {
b, err := k8sutil.GetObjectBytes(obj, yaml.Marshal)
if err != nil {
return err
Expand All @@ -71,7 +71,7 @@ func WriteObject(w io.Writer, obj interface{}) error {
}

// WriteObject writes any object to w.
func WriteYAML(w io.Writer, obj interface{}) error {
func WriteYAML(w io.Writer, obj any) error {
b, err := yaml.Marshal(obj)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions internal/helm/client/actionconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type ActionConfigGetter interface {
func NewActionConfigGetter(cfg *rest.Config, rm meta.RESTMapper, log logr.Logger) (ActionConfigGetter, error) {
rcg := newRESTClientGetter(cfg, rm, "")
// Setup the debug log function that Helm will use
debugLog := func(format string, v ...interface{}) {
debugLog := func(format string, v ...any) {
if log.Enabled() {
log.V(1).Info(fmt.Sprintf(format, v...))
}
Expand Down Expand Up @@ -72,7 +72,7 @@ var _ ActionConfigGetter = &actionConfigGetter{}
type actionConfigGetter struct {
kubeClient *kube.Client
kubeClientSet kubernetes.Interface
debugLog func(string, ...interface{})
debugLog func(string, ...any)
restClientGetter *restClientGetter
watchedSecrets map[string]*WatchedSecrets
watchedSecretsMutex *sync.Mutex
Expand Down
4 changes: 2 additions & 2 deletions internal/helm/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ func (r HelmOperatorReconciler) Reconcile(ctx context.Context, request reconcile
// will be returned. An error will be thrown if the custom resource time period is not in proper format.
func determineReconcilePeriod(currentPeriod time.Duration, o *unstructured.Unstructured) (time.Duration, error) {
// If custom resource annotations are present, they will take precedence over the command-line flag
if annot, exists := o.UnstructuredContent()["metadata"].(map[string]interface{})["annotations"]; exists {
if timeDuration, present := annot.(map[string]interface{})[helmReconcilePeriodAnnotation]; present {
if annot, exists := o.UnstructuredContent()["metadata"].(map[string]any)["annotations"]; exists {
if timeDuration, present := annot.(map[string]any)[helmReconcilePeriodAnnotation]; present {
annotationsPeriod, err := time.ParseDuration(timeDuration.(string))
if err != nil {
return currentPeriod, err // First return value does not matter, since err != nil
Expand Down
Loading
Loading