From f4d10a92abc46bf0156ff1b475304471c16405da Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 13 Apr 2023 02:42:56 -0600 Subject: Try to find misuses of textui.Progress - Add a runtime-check to Progress to notice if we deadlocked or forgot to call .Done(). - Add a runtime-check to Progress.Done() to panic if .Set() was never called (instead of the old behavior of deadlocking). - grep: Use `defer` when possible, to help remember to call .Done(). - grep: Always either call .Set() right away, or right before calling .Done(). --- lib/streamio/runescanner.go | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/streamio') diff --git a/lib/streamio/runescanner.go b/lib/streamio/runescanner.go index 203439f..1206522 100644 --- a/lib/streamio/runescanner.go +++ b/lib/streamio/runescanner.go @@ -103,6 +103,7 @@ func (rs *runeScanner) UnreadRune() error { // ReadRune implements io.Closer. func (rs *runeScanner) Close() error { + rs.progressWriter.Set(rs.progress) rs.progressWriter.Done() return rs.closer.Close() } -- cgit v1.2.3-2-g168b