Skip to content

Instantly share code, notes, and snippets.

View vkorbes's full-sized avatar

V Körbes vkorbes

View GitHub Profile
(dlv) r
Process restarted with PID 6078
(dlv) b main.go:12
Breakpoint 2 set at 0x6fcbb4 for main.main() ./main.go:12
(dlv) clear 1
Breakpoint 1 cleared at 0x6fcb78 for main.main() ./main.go:10
(dlv)
(dlv)
> main.main() ./main.go:12 (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)
(dlv) next
> main.main() ./main.go:11 (PC: 0x6fcb8f)
6: "io/ioutil"
7: "fmt"
8: )
9:
10: func main() {
=> 11: http.HandleFunc("/", webserver)
12: http.ListenAndServe(":8080", nil)
13: message := get()
(dlv) continue
> main.main() ./main.go:10 (hits goroutine(1):1 total:1) (PC: 0x6fcb78)
5: "log"
6: "io/ioutil"
7: "fmt"
8: )
9:
=> 10: func main() {
11: http.HandleFunc("/", webserver)
12: http.ListenAndServe(":8080", nil)
(dlv) break main.main
Breakpoint 1 set at 0x6fcb78 for main.main() ./main.go:10
(dlv)
$ dlv debug
Type 'help' for list of commands.
(dlv)
func get() string {
// Println debugging!
fmt.Println("Got into func get().")
response, err := http.Get("http://localhost:8080/")
if err != nil {
log.Fatalln(err)
}
// Println debugging!
fmt.Println("Sent GET request.")
message, err := ioutil.ReadAll(response.Body)
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
@vkorbes
vkorbes / main.go
Last active June 1, 2019 10:08
network
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/websocket"
"math/rand"
"math"
"net/http"
"os"
├── mesh
│ └── go.mod
│ └── main.go
├── render
│ └── go.mod
│ └── main.go
└── web
└── go.mod
├── index.html
└── main.go