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

Side by Side Diff: 2014/go4java/goodcounter.go

Issue 111050043: code review 111050043: go.talks: add "Go for Javaneros" (Closed)
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:
View unified diff | Download patch
OLDNEW
(Empty)
1 package main
2
3 import (
4 "fmt"
5 "net/http"
6 )
7
8 var nextID = make(chan int)
9
10 func handler(w http.ResponseWriter, q *http.Request) {
11 fmt.Fprintf(w, "<h1>You got %v<h1>", <-nextID)
12 }
13
14 func main() {
15 http.HandleFunc("/next", handler)
16 go func() {
17 for i := 0; ; i++ {
18 nextID <- i
19 }
20 }()
21 http.ListenAndServe("localhost:8080", nil)
22 }
OLDNEW

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