From 7da9360477210b4f254741d41d66f0e70e8af267 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Tue, 2 Apr 2019 11:11:36 +0200 Subject: [PATCH] cli/command/container/stats.go:211:21: SA1015: using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (staticcheck) Signed-off-by: Silvin Lubecki --- cli/command/container/stats.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/command/container/stats.go b/cli/command/container/stats.go index e8309e3324..95afccf5cb 100644 --- a/cli/command/container/stats.go +++ b/cli/command/container/stats.go @@ -208,7 +208,9 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error { } var err error - for range time.Tick(500 * time.Millisecond) { + ticker := time.NewTicker(500 * time.Millisecond) + defer ticker.Stop() + for range ticker.C { cleanScreen() ccstats := []StatsEntry{} cStats.mu.Lock()