-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce gittest #631
Conversation
} | ||
|
||
func getLocalIP(t testing.TB) string { | ||
conn, err := net.Dial("udp", "8.8.8.8:80") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a very common way: https://github.com/search?q=%22net.Dial%28%5C%22udp%5C%22%2C+%5C%228.8.8.8%3A80%5C%22%29%22&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stackoverflow, that's why!
https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go/37382208#37382208
Description
gittest
: provides a test helper for creating a git server that serves a git repository.httptest
: provides similar functionality to thenet/http/httptest
package, but with some additional features: (1) It allows you to listen to all interfaces, not just localhost and (2) for TLS servers, it allows you to specify the host name to use in the certificate.Security