package main
import (
"fmt"
"net/http"
)
func Extract(url string) ([]string, error) {
http.Get(url)
var links []string
return links, nil
}
func crawl(url string) []string {
list, _ := Extract(url)
return list
}
func main() {
var ch = make(chan int)
ch <- 1
}
If I remove the net/http import, it will return a "deadlock" error as expected. But if I import this package, although I didn't invoke the Extract func, the "deadlock" will not appear.
Importing the net package starts background polling Goroutines that effectively disable the deadlock detector.
You can see the discussion for a similar issue here: https://github.com/golang/go/issues/12734
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With