Skip to content

Instantly share code, notes, and snippets.

@manucorporat
Created July 3, 2014 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manucorporat/10d4dd62d8992ed33479 to your computer and use it in GitHub Desktop.
Save manucorporat/10d4dd62d8992ed33479 to your computer and use it in GitHub Desktop.
This doesn't work either
package main
import "net/http"
import "time"
func main() {
http.HandleFunc("/ping", func1)
http.HandleFunc("/ping2", func2)
http.ListenAndServe(":8081", nil)
}
func func1(w http.ResponseWriter, req *http.Request) {
w.Write([]byte("ping1"))
}
func func2(w http.ResponseWriter, req *http.Request) {
go func() {
time.Sleep(5 * time.Second)
w.Write([]byte("ping2"))
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment