Skip to content

Commit 944f117

Browse files
Can now return the pointer directly.
1 parent f9c1671 commit 944f117

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎chapter7/patterns/timer/timer.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ type runner struct {
3636

3737
// NewRunner returns a new ready-to-use runner.
3838
func NewRunner(d time.Duration) *runner {
39-
r := runner{
39+
return &runner{
4040
interrupt: make(chan os.Signal, 1),
4141
complete: make(chan error),
4242
timeout: time.After(d * time.Second),
4343
}
44-
45-
return &r
4644
}
4745

4846
// Add attaches tasks to the runner. A task is a function that takes an int ID.

0 commit comments

Comments
 (0)