Skip to content

Commit d5ee7cb

Browse files
authored
Fix testable example: ExampleObjectPool
Output is only checked when it is the last comment block in the testable example. See this golang issue for more info: golang/go#48362
1 parent 9fea52c commit d5ee7cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/x/pool/example_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ func ExampleObjectPool() {
5050
o := p.Get().(*exampleObject)
5151

5252
fmt.Printf("Retrieved struct should have default values: %+v", o)
53-
// Output: Retrieved struct should have default values: &{a:0 b:0 c:0}
5453

5554
// Use the exampleObject.
5655
_ = o
5756

5857
// Reset the exampleObject and return it to the pool.
5958
o.reset()
6059
p.Put(o)
60+
61+
// Output: Retrieved struct should have default values: &{a:0 b:0 c:0}
6162
}

0 commit comments

Comments
 (0)