猿问

无法访问 raw.githubusercontent.com

我想通过 raw.githubusercontent.com 在 github 中下载一些文件。


在使用golang实现这个功能的时候,遇到如下错误:


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 here

resp, err := http.Get(url1)

注意:如果我直接在网站上打开,我可以正常访问该文件。


米琪卡哇伊
浏览 396回答 1
1回答

慕码人8056858

此错误消息与 WinsockWSANO_DATA错误代码相关联。这意味着,您尝试连接的域名的 DNS 记录存在问题。见这里: https ://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA我认为重新启动服务器可能会解决它。您应该调查环境的 DNS 设置如果您手动输入地址,请确保拼写正确尝试手动输入 URL
随时随地看视频慕课网APP

相关分类

Go
我要回答