Why doesn't this code return a “deadlock” error?

前端 未结 1 1621
灰色年华
灰色年华 2021-01-13 13:29
package main

import (
    \"fmt\"
    \"net/http\"
)

func Extract(url string) ([]string, error) {
    http.Get(url)

    var links []string
    return links, nil
}         


        
相关标签:
1条回答
  • 2021-01-13 14:21

    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

    0 讨论(0)
提交回复
热议问题