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

Side by Side Diff: 2013/go-sreops/goroutines.go

Issue 87910043: code review 87910043: go.talks: fix build; add "// +build OMIT" to many samples (Closed)
Patch Set: diff -r 64c0764808ba https://code.google.com/p/go.talks Created 9 years, 11 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:
View unified diff | Download patch
« no previous file with comments | « 2013/distsys/writebuffer2.go ('k') | 2013/go-sreops/goroutines-channels.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // +build OMIT
2
1 package main 3 package main
2 4
3 import ( 5 import (
4 "fmt" 6 "fmt"
5 "time" 7 "time"
6 ) 8 )
7 9
8 func main() { 10 func main() {
9 go say("ho!", 2*time.Second) // & 11 go say("ho!", 2*time.Second) // &
10 go say("hey!", 1*time.Second) // & 12 go say("hey!", 1*time.Second) // &
11 13
12 // Make main sleep for 4 seconds so goroutines can finish 14 // Make main sleep for 4 seconds so goroutines can finish
13 time.Sleep(4 * time.Second) 15 time.Sleep(4 * time.Second)
14 } 16 }
15 17
16 // say prints text after sleeping for X secs 18 // say prints text after sleeping for X secs
17 func say(text string, secs time.Duration) { 19 func say(text string, secs time.Duration) {
18 time.Sleep(secs) 20 time.Sleep(secs)
19 fmt.Println(text) 21 fmt.Println(text)
20 } 22 }
OLDNEW
« no previous file with comments | « 2013/distsys/writebuffer2.go ('k') | 2013/go-sreops/goroutines-channels.go » ('j') | no next file with comments »

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