From b9cdaa6ce684c5e4e34c41959baf529fc6b7aaaf Mon Sep 17 00:00:00 2001 From: vovapi Date: Mon, 9 Dec 2019 17:47:00 +0300 Subject: [PATCH 1/2] testing: conventional comments for exported internal funcs & structs --- src/testing/benchmark.go | 10 +++++----- src/testing/example.go | 4 ++-- src/testing/testing.go | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go index e954fc6ccbbac8..28b407ee98bae8 100644 --- a/src/testing/benchmark.go +++ b/src/testing/benchmark.go @@ -69,8 +69,8 @@ var benchmarkLock sync.Mutex // Used for every benchmark for measuring memory. var memStats runtime.MemStats -// An internal type but exported because it is cross-package; part of the implementation -// of the "go test" command. +// InternalBenchmark is an internal type but exported because it is cross-package; +// part of the implementation of the "go test" command. type InternalBenchmark struct { Name string F func(b *B) @@ -342,7 +342,7 @@ func (b *B) ReportMetric(n float64, unit string) { b.extra[unit] = n } -// The results of a benchmark run. +// BenchmarkResult is the results of a benchmark run. type BenchmarkResult struct { N int // The number of iterations. T time.Duration // The total time taken. @@ -488,8 +488,8 @@ type benchContext struct { extLen int // Maximum extension length. } -// An internal function but exported because it is cross-package; part of the implementation -// of the "go test" command. +// RunBenchmarks is an internal function but exported because it is cross-package; +// part of the implementation of the "go test" command. func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark) { runBenchmarks("", matchString, benchmarks) } diff --git a/src/testing/example.go b/src/testing/example.go index c122121289d379..cd78408e690e35 100644 --- a/src/testing/example.go +++ b/src/testing/example.go @@ -19,8 +19,8 @@ type InternalExample struct { Unordered bool } -// An internal function but exported because it is cross-package; part of the implementation -// of the "go test" command. +// RunExamples is an internal function but exported because it is cross-package; +// part of the implementation of the "go test" command. func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) { _, ok = runExamples(matchString, examples) return ok diff --git a/src/testing/testing.go b/src/testing/testing.go index 5f13e60f4f621b..7f1047da560592 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -863,8 +863,8 @@ func (t *T) Parallel() { t.raceErrors += -race.Errors() } -// An internal type but exported because it is cross-package; part of the implementation -// of the "go test" command. +// InternalTest is an internal type but exported because it is cross-package; +// part of the implementation of the "go test" command. type InternalTest struct { Name string F func(*T) @@ -1214,8 +1214,8 @@ func listTests(matchString func(pat, str string) (bool, error), tests []Internal } } -// An internal function but exported because it is cross-package; part of the implementation -// of the "go test" command. +// RunTests is an internal function but exported because it is cross-package; +// part of the implementation of the "go test" command. func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool) { ran, ok := runTests(matchString, tests) if !ran && !haveExamples { From aa637756e772f5ee9094b802df3be9945c8466c4 Mon Sep 17 00:00:00 2001 From: vovapi Date: Tue, 10 Dec 2019 13:33:26 +0300 Subject: [PATCH 2/2] testing: fixes after the review --- src/testing/benchmark.go | 6 +++--- src/testing/example.go | 2 +- src/testing/testing.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go index 28b407ee98bae8..04127727c1112d 100644 --- a/src/testing/benchmark.go +++ b/src/testing/benchmark.go @@ -70,7 +70,7 @@ var benchmarkLock sync.Mutex var memStats runtime.MemStats // InternalBenchmark is an internal type but exported because it is cross-package; -// part of the implementation of the "go test" command. +// it is part of the implementation of the "go test" command. type InternalBenchmark struct { Name string F func(b *B) @@ -342,7 +342,7 @@ func (b *B) ReportMetric(n float64, unit string) { b.extra[unit] = n } -// BenchmarkResult is the results of a benchmark run. +// BenchmarkResult contains the results of a benchmark run. type BenchmarkResult struct { N int // The number of iterations. T time.Duration // The total time taken. @@ -489,7 +489,7 @@ type benchContext struct { } // RunBenchmarks is an internal function but exported because it is cross-package; -// part of the implementation of the "go test" command. +// it is part of the implementation of the "go test" command. func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark) { runBenchmarks("", matchString, benchmarks) } diff --git a/src/testing/example.go b/src/testing/example.go index cd78408e690e35..adc91d5faf6648 100644 --- a/src/testing/example.go +++ b/src/testing/example.go @@ -20,7 +20,7 @@ type InternalExample struct { } // RunExamples is an internal function but exported because it is cross-package; -// part of the implementation of the "go test" command. +// it is part of the implementation of the "go test" command. func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) { _, ok = runExamples(matchString, examples) return ok diff --git a/src/testing/testing.go b/src/testing/testing.go index 7f1047da560592..15ff1dd81d0c89 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -864,7 +864,7 @@ func (t *T) Parallel() { } // InternalTest is an internal type but exported because it is cross-package; -// part of the implementation of the "go test" command. +// it is part of the implementation of the "go test" command. type InternalTest struct { Name string F func(*T) @@ -1215,7 +1215,7 @@ func listTests(matchString func(pat, str string) (bool, error), tests []Internal } // RunTests is an internal function but exported because it is cross-package; -// part of the implementation of the "go test" command. +// it is part of the implementation of the "go test" command. func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool) { ran, ok := runTests(matchString, tests) if !ran && !haveExamples {