From 6f13e20d79f76308ec329cb9fce44f9896dbb634 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 24 Apr 2024 15:04:50 -0500 Subject: [PATCH] lint: Add `tea.Quit` to forbidigo to prevent future memory leaks --- .golangci.yaml | 5 +++++ internal/movie/player.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.golangci.yaml b/.golangci.yaml index 5ab96afc..03217be5 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -8,6 +8,11 @@ linters-settings: gosec: excludes: - G306 + forbidigo: + forbid: + - "^(fmt\\.Print(|f|ln)|print|println)$" + - p: "^tea\\.Quit$" + msg: tea.Quit may cause a memory leak linters: enable: diff --git a/internal/movie/player.go b/internal/movie/player.go index decad7d2..71779050 100644 --- a/internal/movie/player.go +++ b/internal/movie/player.go @@ -158,7 +158,7 @@ func (p Player) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } p.clearTimeouts() p.zone.Close() - return p, tea.Quit + return p, tea.Quit //nolint:forbidigo case PlayerOption: p.optionViewStale = true return p, p.doPlayerOption(msg)