Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(952)

Delta Between Two Patch Sets: 2014/go4java/runner/embed.go

Issue 111050043: code review 111050043: go.talks: add "Go for Javaneros" (Closed)
Left Patch Set: Created 9 years, 8 months ago
Right Patch Set: diff -r f10c43fe60f9 https://code.google.com/p/go.talks Created 9 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 package runner
2
3 // RunCounter2 is completely equivalent to RunCounter,
4 // but uses struct embedding to avoid the boilerplate of redeclaring
5 // the Name method.
6 type RunCounter2 struct {
7 Runner // HL
8 count int
9 }
10
11 func NewRunCounter2(name string) *RunCounter2 {
12 return &RunCounter2{Runner{name}, 0}
13 }
14
15 func (r *RunCounter2) Run(t Task) {
16 r.count++
17 r.Runner.Run(t) // HL
18 }
19
20 func (r *RunCounter2) RunAll(ts []Task) {
21 r.count += len(ts)
22 r.Runner.RunAll(ts) // HL
23 }
24
25 func (r *RunCounter2) Count() int { return r.count }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b