Skip to content

Instantly share code, notes, and snippets.

@vkorbes
Created July 4, 2019 12:41
Show Gist options
  • Save vkorbes/bdefa0de2935ff69647e68c37251116f to your computer and use it in GitHub Desktop.
Save vkorbes/bdefa0de2935ff69647e68c37251116f to your computer and use it in GitHub Desktop.
(dlv) c
> main.main() ./main.go:12 (hits goroutine(1):1 total:1) (PC: 0x6fcbb4)
7: "fmt"
8: )
9:
10: func main() {
11: http.HandleFunc("/", webserver)
=> 12: http.ListenAndServe(":8080", nil)
13: message := get()
14: fmt.Println("The webserver said:", message)
15: }
16:
17: func webserver(w http.ResponseWriter, r *http.Request) {
(dlv) s
> net/http.ListenAndServe() /usr/local/go/src/net/http/server.go:3002 (PC: 0x6c72b3)
2997: // Accepted connections are configured to enable TCP keep-alives.
2998: //
2999: // The handler is typically nil, in which case the DefaultServeMux is used.
3000: //
3001: // ListenAndServe always returns a non-nil error.
=>3002: func ListenAndServe(addr string, handler Handler) error {
3003: server := &Server{Addr: addr, Handler: handler}
3004: return server.ListenAndServe()
3005: }
3006:
3007: // ListenAndServeTLS acts identically to ListenAndServe, except that it
(dlv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment