From 041c5d83486fce4a1c8b549a3c6f9c1951b0aea8 Mon Sep 17 00:00:00 2001 From: Alberto Donizetti Date: Wed, 21 Mar 2018 11:53:51 +0100 Subject: [PATCH] cmd/trace: remove unused variable in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unused variables in closures are currently not diagnosed by the compiler (this is Issue #3059), while go/types catches them. One unused variable in the cmd/trace tests is causing the go/types test that typechecks the whole standard library to fail: FAIL: TestStdlib (8.05s) stdlib_test.go:223: cmd/trace/annotations_test.go:241:6: gcTime declared but not used FAIL Remove it. Updates #24464 Change-Id: I0f1b9db6ae1f0130616ee649bdbfdc91e38d2184 Reviewed-on: https://go-review.googlesource.com/101815 Reviewed-by: Daniel Martí --- src/cmd/trace/annotations_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cmd/trace/annotations_test.go b/src/cmd/trace/annotations_test.go index 1a68b0e2a4..161d1ec0b1 100644 --- a/src/cmd/trace/annotations_test.go +++ b/src/cmd/trace/annotations_test.go @@ -238,12 +238,10 @@ func prog2() (gcTime time.Duration) { } func TestAnalyzeAnnotationGC(t *testing.T) { - var gcTime time.Duration err := traceProgram(t, func() { oldGC := debug.SetGCPercent(10000) // gc, and effectively disable GC defer debug.SetGCPercent(oldGC) - - gcTime = prog2() + prog2() }, "TestAnalyzeAnnotationGC") if err != nil { t.Fatalf("failed to trace the program: %v", err)