英文:
Unable to access 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"
// 上述提到的错误将在这里出现
resp, err := http.Get(url1)
注意:
如果我直接在网站上打开它,我可以正常访问该文件。
英文:
I want to download some files in github by raw.githubusercontent.com.
When using golang to implement this function, I encountered the following error:
dial tcp: lookup raw.githubusercontent.com: getaddrinfow: The requested name is valid, but no data of the requested type was found.
My code:
url1 := "https://raw.githubusercontent.com/pupillord/tiny-cs/main/README.md"
// the error mentioned above will appear here
resp, err := http.Get(url1)
Note:
If I open it directly on the website, I can access the file normally.
答案1
得分: 0
这个错误消息与Winsock的WSANO_DATA
错误代码相关。它意味着你尝试连接的域名的DNS记录存在问题。
请参考这里:
https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA
- 我认为重新启动服务器可能会解决问题。
- 你应该调查一下你的环境的DNS设置。
- 如果你手动输入了地址,请确保拼写正确。
- 尝试手动输入URL。
英文:
This error message is associated with the Winsock WSANO_DATA
error code. It means, there is some problem with DNS record of the domain name you are trying to connect to.
See here :
https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA
- I think restarting server might fix it.
- you should investigate your environment's DNS settings
- If you manually entered the addres, make sure that the spelling is
correct - try entering the URL manually
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论