whatcanGOwrong

This commit is contained in:
2024-09-19 21:38:24 -04:00
commit d0ae4d841d
17908 changed files with 4096831 additions and 0 deletions
@@ -0,0 +1,23 @@
package main
import (
"fmt"
"log"
"net/http"
"sync"
)
func main() {
http.HandleFunc("/test", func(w http.ResponseWriter, req *http.Request) {
go func() {
// I know this is wrong, it is just to simulate a deadlocked goroutine
fmt.Println("locking...")
mtx := &sync.Mutex{}
mtx.Lock()
mtx.Lock()
fmt.Println("will never print this")
}()
})
log.Fatalln(http.ListenAndServe("127.0.0.1:8888", nil))
}