From 43c2b9071620625ca147888e13cbcfbb4d33f8fd Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 11 May 2020 12:47:27 +0200 Subject: [PATCH] widget: simplify popping an element from a slice Signed-off-by: Elias Naur --- widget/button.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/button.go b/widget/button.go index 30583b8f..b42a7075 100644 --- a/widget/button.go +++ b/widget/button.go @@ -56,8 +56,8 @@ func (b *Button) Layout(gtx *layout.Context) { if gtx.Now().Sub(c.Time) < 1*time.Second { break } - copy(b.history, b.history[1:]) - b.history = b.history[:len(b.history)-1] + n := copy(b.history, b.history[1:]) + b.history = b.history[:n] } }