Skip to content

Commit 4a8b763

Browse files
Remove usages of "new" as variable name
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
1 parent bee9608 commit 4a8b763

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pkg/env/env.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ import (
1414
// MergeEnvVars merges one slice of corev1.EnvVar into another slice of corev1.EnvVar
1515
// if overwriteValues is false, this function will return an error if a duplicate EnvVar name is encountered
1616
// if overwriteValues is true, this function will overwrite the existing value with the new value if a duplicate is encountered
17-
func MergeEnvVars(new []corev1.EnvVar, into []corev1.EnvVar, overwriteValues bool) ([]corev1.EnvVar, error) {
18-
// if new, into, or both are empty, there is no need to run through the processing logic
17+
func MergeEnvVars(from []corev1.EnvVar, into []corev1.EnvVar, overwriteValues bool) ([]corev1.EnvVar, error) {
18+
// if from, into, or both are empty, there is no need to run through the processing logic
1919
// just quickly return the appropriate value
20-
if len(new) == 0 && len(into) == 0 {
20+
if len(from) == 0 && len(into) == 0 {
2121
return []corev1.EnvVar{}, nil
22-
} else if len(new) == 0 {
22+
} else if len(from) == 0 {
2323
return into, nil
2424
} else if len(into) == 0 {
25-
return new, nil
25+
return from, nil
2626
}
2727

2828
// create a map of the original (into) env vars with the name as the key and
@@ -38,7 +38,7 @@ func MergeEnvVars(new []corev1.EnvVar, into []corev1.EnvVar, overwriteValues boo
3838

3939
// merge the new env vars into the original env vars list following a few simple rules
4040
// based on if the name already exists and whether overwriteValues is true or false
41-
for _, n := range new {
41+
for _, n := range from {
4242
_, exists := originalEnvs[n.Name]
4343

4444
switch {

pkg/volumes/volumes.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ func isReadOnlyVolume(strategyVolume *buildv1beta1.BuildStrategyVolume) bool {
6969
// MergeBuildVolumes merges Build Volumes from one list into the other. It only allows to merge those that have property
7070
// Overridable set to true. In case it is empty or false, it is not allowed to be overridden, so Volume cannot be merged
7171
// Merging in this context means copying the VolumeSource from one object to the other.
72-
func MergeBuildVolumes(into []buildv1beta1.BuildStrategyVolume, new []buildv1beta1.BuildVolume) ([]buildv1beta1.BuildStrategyVolume, error) {
73-
if len(new) == 0 && len(into) == 0 {
72+
func MergeBuildVolumes(into []buildv1beta1.BuildStrategyVolume, from []buildv1beta1.BuildVolume) ([]buildv1beta1.BuildStrategyVolume, error) {
73+
if len(from) == 0 && len(into) == 0 {
7474
return []buildv1beta1.BuildStrategyVolume{}, nil
7575
}
76-
if len(new) == 0 {
76+
if len(from) == 0 {
7777
return into, nil
7878
}
7979

@@ -87,7 +87,7 @@ func MergeBuildVolumes(into []buildv1beta1.BuildStrategyVolume, new []buildv1bet
8787
mergeMap[vol.Name] = *vol.DeepCopy()
8888
}
8989

90-
for _, merger := range new {
90+
for _, merger := range from {
9191
original, ok := mergeMap[merger.Name]
9292
if !ok {
9393
errors = append(errors, fmt.Errorf("Build Volume %q is not found in the BuildStrategy", merger.Name))

0 commit comments

Comments
 (0)