我的 Go 代碼中有非常奇怪的行為??傮w要點是,當(dāng)我有for { if messagesRecieved == l { break } select { case result := <-results: newWords[result.index] = result.word messagesRecieved += 1 default: // fmt.Printf("messagesRecieved: %v\n", messagesRecieved) if i != l { request := Request{word: words[i], index: i, thesaurus_word: results} requests <- request i += 1 } }}程序凍結(jié)并且無法前進,但是當(dāng)我取消注釋 fmt.Printf 命令時,程序運行正常。您可以在此處查看完整代碼。有誰知道是什么導(dǎo)致了這種行為?
- 1 回答
- 0 關(guān)注
- 191 瀏覽
添加回答
舉報
0/150
提交
取消