blob: fde600c2b5c3edaf057cc248bc24b113f8bf00b4 [file] [log] [blame]
// +build ignore,OMIT
package main
import (
"fmt"
"net/http"
)
var battle = make(chan string)
func handler(w http.ResponseWriter, q *http.Request) {
select {
case battle <- q.FormValue("usr"):
fmt.Fprintf(w, "You won!")
case won := <-battle:
fmt.Fprintf(w, "You lost, %v is better than you", won)
}
}
func main() {
http.HandleFunc("/fight", handler)
http.ListenAndServe("localhost:8080", nil)
}