This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k8s_yaml(['web/manifest.yml', 'router/manifest.yml', 'links/manifest.yml']) | |
docker_build('docker.io/ellenkorbes/web', 'web') | |
docker_build('docker.io/ellenkorbes/router', 'router') | |
docker_build('docker.io/ellenkorbes/links', 'links') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ dlv debug | |
Type 'help' for list of commands. | |
(dlv) b main.go:28 | |
Breakpoint 1 set at 0x6fcffe for main.get() ./main.go:28 | |
(dlv) c | |
> main.get() ./main.go:28 (hits goroutine(1):1 total:1) (PC: 0x6fcffe) | |
23: if err != nil { | |
24: log.Fatalln(err) | |
25: } | |
26: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go run main.go | |
The webserver said: Howdy! | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
http.HandleFunc("/", webserver) | |
go http.ListenAndServe(":8080", nil) // Fixed! | |
message := get() | |
fmt.Println("The webserver said:", message) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
http.HandleFunc("/", webserver) | |
http.ListenAndServe(":8080", nil) // This blocks! | |
message := get() // Code never gets here. | |
fmt.Println("The webserver said:", message) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> net/http.(*Server).Serve() /usr/local/go/src/net/http/server.go:2825 (PC: 0x6c685b) | |
2820: defer srv.trackListener(&l, false) | |
2821: | |
2822: var tempDelay time.Duration // how long to sleep on accept failure | |
2823: baseCtx := context.Background() // base is always background, per Issue 16220 | |
2824: ctx := context.WithValue(baseCtx, ServerContextKey, srv) | |
=>2825: for { | |
2826: rw, e := l.Accept() | |
2827: if e != nil { | |
2828: select { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(dlv) break /usr/local/go/src/net/http/server.go:2764 | |
Breakpoint 2 set at 0x6c63d5 for net/http.(*Server).ListenAndServe() /usr/local/go/src/net/http/server.go:2764 | |
(dlv) breakpoints | |
Breakpoint 1 at 0x6fcb78 for main.main() ./main.go:10 (1) | |
Breakpoint 2 at 0x6c63d5 for net/http.(*Server).ListenAndServe() /usr/local/go/src/net/http/server.go:2764 (0) | |
(dlv) clear 1 | |
Breakpoint 1 cleared at 0x6fcb78 for main.main() ./main.go:10 | |
(dlv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> net/http.(*Server).ListenAndServe() /usr/local/go/src/net/http/server.go:2764 (hits goroutine(1):1 total:1) (PC: 0x6c63d5) | |
2759: } | |
2760: ln, err := net.Listen("tcp", addr) | |
2761: if err != nil { | |
2762: return err | |
2763: } | |
=>2764: return srv.Serve(tcpKeepAliveListener{ln.(*net.TCPListener)}) | |
2765: } | |
2766: | |
2767: var testHookServerServe func(*Server, net.Listener) // used if non-nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> net/http.(*Server).ListenAndServe() /usr/local/go/src/net/http/server.go:2752 (PC: 0x6c6248) | |
2747: // | |
2748: // If srv.Addr is blank, ":http" is used. | |
2749: // | |
2750: // ListenAndServe always returns a non-nil error. After Shutdown or Close, | |
2751: // the returned error is ErrServerClosed. | |
=>2752: func (srv *Server) ListenAndServe() error { | |
2753: if srv.shuttingDown() { | |
2754: return ErrServerClosed | |
2755: } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
NewerOlder