Skip to content

Commit 61026f7

Browse files
authored
refactor: Delete unused code (#687)
**What problem does this PR solve?**: **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent 1e9e020 commit 61026f7

File tree

4 files changed

+13
-101
lines changed

4 files changed

+13
-101
lines changed

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/variables/enums.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

api/variables/eums_test.go

Lines changed: 0 additions & 70 deletions
This file was deleted.

api/variables/json.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ import (
1313
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
1414
)
1515

16-
func MustMarshal(val any) *apiextensionsv1.JSON {
17-
marshaled, err := json.Marshal(val)
18-
if err != nil {
19-
panic(fmt.Errorf("failed to marshal enum value: %w", err))
20-
}
21-
22-
return &apiextensionsv1.JSON{Raw: marshaled}
23-
}
24-
2516
func MarshalToClusterVariable[T any](name string, obj T) (*clusterv1.ClusterVariable, error) {
2617
marshaled, err := json.Marshal(obj)
2718
if err != nil {
@@ -33,7 +24,9 @@ func MarshalToClusterVariable[T any](name string, obj T) (*clusterv1.ClusterVari
3324
}, nil
3425
}
3526

36-
func UnmarshalClusterConfigVariable(clusterVariables []clusterv1.ClusterVariable) (*ClusterConfigSpec, error) {
27+
func UnmarshalClusterConfigVariable(
28+
clusterVariables []clusterv1.ClusterVariable,
29+
) (*ClusterConfigSpec, error) {
3730
variableName := v1alpha1.ClusterConfigVariableName
3831
clusterConfig := GetClusterVariableByName(variableName, clusterVariables)
3932
if clusterConfig == nil {
@@ -48,7 +41,9 @@ func UnmarshalClusterConfigVariable(clusterVariables []clusterv1.ClusterVariable
4841
return spec, nil
4942
}
5043

51-
func UnmarshalWorkerConfigVariable(clusterVariables []clusterv1.ClusterVariable) (*WorkerNodeConfigSpec, error) {
44+
func UnmarshalWorkerConfigVariable(
45+
clusterVariables []clusterv1.ClusterVariable,
46+
) (*WorkerNodeConfigSpec, error) {
5247
variableName := v1alpha1.WorkerConfigVariableName
5348
workerConfig := GetClusterVariableByName(variableName, clusterVariables)
5449
if workerConfig == nil {
@@ -72,7 +67,10 @@ func UnmarshalClusterVariable[T any](clusterVariable *clusterv1.ClusterVariable,
7267
return nil
7368
}
7469

75-
func GetClusterVariableByName(name string, clusterVariables []clusterv1.ClusterVariable) *clusterv1.ClusterVariable {
70+
func GetClusterVariableByName(
71+
name string,
72+
clusterVariables []clusterv1.ClusterVariable,
73+
) *clusterv1.ClusterVariable {
7674
for _, clusterVar := range clusterVariables {
7775
if clusterVar.Name == name {
7876
return &clusterVar

0 commit comments

Comments
 (0)