Remove pointer to slice, slices are always passed by reference
@@ -226,8 +226,8 @@ func (m *Machine) PodLabeled(namespace string, name string, desiredLabel, desire
}
// ContainExpectedEvent return true if events contain target resource event
-func (m *Machine) ContainExpectedEvent(events *[]corev1.Event, reason string, message string) bool {
- for _, event := range *events {
+func (m *Machine) ContainExpectedEvent(events []corev1.Event, reason string, message string) bool {
+ for _, event := range events {
if event.Reason == reason && strings.Contains(event.Message, message) {
return true
}
@@ -237,20 +237,20 @@ func (m *Machine) ContainExpectedEvent(events *[]corev1.Event, reason string, me
}
// GetBOSHDeploymentEvents gets target resource events
-func (m *Machine) GetBOSHDeploymentEvents(namespace string, name string, id string) (*[]corev1.Event, error) {
+func (m *Machine) GetBOSHDeploymentEvents(namespace string, name string, id string) ([]corev1.Event, error) {
fieldSelector := fields.Set{"involvedObject.name": name, "involvedObject.uid": id}.AsSelector().String()
err := m.WaitForBOSHDeploymentEvent(namespace, fieldSelector)
if err != nil {
- return &[]corev1.Event{}, err
+ return []corev1.Event{}, err
}
events := m.Clientset.CoreV1().Events(namespace)
list, err := events.List(metav1.ListOptions{FieldSelector: fieldSelector})
if err != nil {
- return &[]corev1.Event{}, err
+ return []corev1.Event{}, err
}
- return &list.Items, nil
+ return list.Items, nil
}
// WaitForBOSHDeploymentEvent gets desired event
