Skip to content

Commit 4b37d8c

Browse files
author
Per G. da Silva
committed
Fix UnmarshalConfig function name
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
1 parent 443d7a2 commit 4b37d8c

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

internal/operator-controller/applier/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (r *RegistryV1ManifestProvider) Get(bundleFS fs.FS, ext *ocv1.ClusterExtens
6969
}
7070

7171
if r.IsSingleOwnNamespaceEnabled {
72-
bundleConfig, err := bundle.UnmarshallConfig(ext.ExtensionConfigBytes(), rv1, ext.Spec.Namespace)
72+
bundleConfig, err := bundle.UnmarshalConfig(ext.ExtensionConfigBytes(), rv1, ext.Spec.Namespace)
7373
if err != nil {
7474
return nil, fmt.Errorf("invalid bundle configuration: %w", err)
7575
}

internal/operator-controller/rukpak/bundle/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ type Config struct {
1717
WatchNamespace *string `json:"watchNamespace"`
1818
}
1919

20-
// UnmarshallConfig returns a deserialized and validated *bundle.Config based on bytes and validated
20+
// UnmarshalConfig returns a deserialized and validated *bundle.Config based on bytes and validated
2121
// against rv1 and the desired install namespaces. It will error if:
2222
// - rv is nil
2323
// - bytes is not a valid YAML/JSON object
2424
// - bytes is a valid YAML/JSON object but does not follow the registry+v1 schema
2525
// if bytes is nil it will be treated as an empty json object ({})
26-
func UnmarshallConfig(bytes []byte, rv1 RegistryV1, installNamespace string) (*Config, error) {
26+
func UnmarshalConfig(bytes []byte, rv1 RegistryV1, installNamespace string) (*Config, error) {
2727
if bytes == nil {
2828
bytes = []byte("{}")
2929
}
3030

3131
bundleConfig := &Config{}
3232
if err := yaml.UnmarshalStrict(bytes, bundleConfig); err != nil {
33-
return nil, fmt.Errorf("error unmarshalling registry+v1 configuration: %w", formatUnmarshallError(err))
33+
return nil, fmt.Errorf("error unmarshalling registry+v1 configuration: %w", formatUnmarshalError(err))
3434
}
3535

3636
// collect bundle install modes
@@ -98,8 +98,8 @@ func isWatchNamespaceConfigRequired(bundleInstallModeSet sets.Set[v1alpha1.Insta
9898
!bundleInstallModeSet.Has(v1alpha1.InstallMode{Type: v1alpha1.InstallModeTypeAllNamespaces, Supported: true})
9999
}
100100

101-
// formatUnmarshallError format JSON unmarshal errors to be more readable
102-
func formatUnmarshallError(err error) error {
101+
// formatUnmarshalError format JSON unmarshal errors to be more readable
102+
func formatUnmarshalError(err error) error {
103103
var unmarshalErr *json.UnmarshalTypeError
104104
if errors.As(err, &unmarshalErr) {
105105
if unmarshalErr.Field == "" {

internal/operator-controller/rukpak/bundle/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing/clusterserviceversion"
1313
)
1414

15-
func Test_UnmarshallConfig(t *testing.T) {
15+
func Test_UnmarshalConfig(t *testing.T) {
1616
for _, tc := range []struct {
1717
name string
1818
rawConfig []byte
@@ -299,7 +299,7 @@ func Test_UnmarshallConfig(t *testing.T) {
299299
}
300300
}
301301

302-
config, err := bundle.UnmarshallConfig(tc.rawConfig, rv1, tc.installNamespace)
302+
config, err := bundle.UnmarshalConfig(tc.rawConfig, rv1, tc.installNamespace)
303303
require.Equal(t, tc.expectedConfig, config)
304304
if tc.expectedErrMessage != "" {
305305
require.Error(t, err)

0 commit comments

Comments
 (0)