gitlab.com/Raven-IO/raven-delve@v1.22.4/_fixtures/notify-v2.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"log"
     6  	"net/http"
     7  	"sync"
     8  )
     9  
    10  func main() {
    11  	http.HandleFunc("/test", func(w http.ResponseWriter, req *http.Request) {
    12  		go func() {
    13  			// I know this is wrong, it is just to simulate a deadlocked goroutine
    14  			fmt.Println("locking...")
    15  			mtx := &sync.Mutex{}
    16  			mtx.Lock()
    17  			mtx.Lock()
    18  			fmt.Println("will never print this")
    19  		}()
    20  	})
    21  
    22  	log.Fatalln(http.ListenAndServe("127.0.0.1:8888", nil))
    23  }