Skip to content

Commit

Permalink
Do not check for empty container list.
Browse files Browse the repository at this point in the history
Much safer assignment in goroutine.
  • Loading branch information
eLco committed Apr 21, 2020
1 parent 22eef17 commit db115e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions pkg/kapp/cmd/app/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ func (o *LogsOptions) Run() error {
}

contFilter := func(pod corev1.Pod) []string {
if len(o.LogsFlags.ContainerNames) > 0 {
return o.LogsFlags.ContainerNames
}
return nil
return o.LogsFlags.ContainerNames
}

logsView := ctllogs.NewView(logOpts, podWatcher, contFilter, supportObjs.CoreClient, o.ui)
Expand Down
5 changes: 3 additions & 2 deletions pkg/kapp/logs/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ func (v View) Show(cancelCh chan struct{}) error {
return fmt.Sprintf("%s > %s", pod.Name, cont.Name)
}

v.tailOpts.ContainerNames = v.contFilterFunc(pod)
tailOpts := v.tailOpts
tailOpts.ContainerNames = v.contFilterFunc(pod)

err := NewPodLog(pod, podsClient, tagFunc, v.tailOpts).TailAll(v.ui, cancelPodTailCh)
err := NewPodLog(pod, podsClient, tagFunc, tailOpts).TailAll(v.ui, cancelPodTailCh)
if err != nil {
v.ui.BeginLinef("Pod logs tailing error: %s\n", err)
}
Expand Down

0 comments on commit db115e4

Please sign in to comment.