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.
CodePudding user response:
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://docs.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
