我想通過 raw.githubusercontent.com 在 github 中下載一些文件。在使用golang實(shí)現(xiàn)這個(gè)功能的時(shí)候,遇到如下錯(cuò)誤:dial tcp: lookup raw.githubusercontent.com: getaddrinfow: The requested name is valid, but no data of the requested type was found.我的代碼:url1 := "https://raw.githubusercontent.com/pupillord/tiny-cs/main/README.md"// the error mentioned above will appear hereresp, err := http.Get(url1)注意:如果我直接在網(wǎng)站上打開,我可以正常訪問該文件。
1 回答
慕碼人8056858
TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個(gè)贊
此錯(cuò)誤消息與 WinsockWSANO_DATA錯(cuò)誤代碼相關(guān)聯(lián)。這意味著,您嘗試連接的域名的 DNS 記錄存在問題。
見這里: https ://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA
我認(rèn)為重新啟動(dòng)服務(wù)器可能會(huì)解決它。
您應(yīng)該調(diào)查環(huán)境的 DNS 設(shè)置
如果您手動(dòng)輸入地址,請(qǐng)確保拼寫正確
嘗試手動(dòng)輸入 URL
- 1 回答
- 0 關(guān)注
- 397 瀏覽
添加回答
舉報(bào)
0/150
提交
取消
