与功能Wait()有关的问题

时间:2019-09-03 02:41:58

标签: mysql go

我正在尝试建立一个Toplist应用程序,以在Internet上获得热门话题。 Github项目为here。该项目由Golang和Mysql构建。

程序尝试同时从多个页面中获取热门信息。运行客户端应用程序时,错误显示dial tcp: lookup tcp/port: getaddrinfow: The specified class was not found.

请注意,我是golang和mysql的新手,如果我对这个问题的描述不够好,请原谅我。 :)

我在Windows OS上。我在Github上打开了一个有关此错误的问题,但尚未得到答复。 getaddrinfow似乎是与Windows套接字相关的功能,我在此site

中找到了该功能。

我在Goland中调试了代码。我在这行中出错:

group.Wait()中发生错误

    allData := []string{
        "V2EX",
        "ZhiHu",
        "WeiBo",
    }
    fmt.Println("starting catching" + strconv.Itoa(len(allData)) + "types of data")
    group.Add(len(allData))
    var spider Spider
    for _, value := range allData {
        fmt.Println("starting catching" + value)
        spider = Spider{DataType: value}
        go ExecGetData(spider)
    }
    group.Wait() //error occured in group.Wait()
    fmt.Print("completed catching")
}

这里是引发错误的位置(第5行)。

        if atomic.CompareAndSwapUint64(statep, state, state+1) {
            if race.Enabled && w == 0 {
                race.Write(unsafe.Pointer(semap))
            }
            runtime_Semacquire(semap) // where error occured
            if *statep != 0 {
                panic("sync: WaitGroup is reused before previous Wait has returned")

0 个答案:

没有答案
相关问题