findFreePort returns a currently free TCP port on the localhost. There are two potential issues with this function: * There is the potential for the port to be taken between the function returning and the port actually being used. * The system _may_ hold on to the socket after it has been told to cl
()
| 37 | // * The system _may_ hold on to the socket after it has been told to close. |
| 38 | // Because of these issues, there is a potential for flakiness. |
| 39 | func findFreePort() (int, error) { |
| 40 | dummy, err := net.Listen("tcp", ":0") |
| 41 | if err != nil { |
| 42 | return 0, err |
| 43 | } |
| 44 | defer dummy.Close() |
| 45 | return dummy.Addr().(*net.TCPAddr).Port, nil |
| 46 | } |
| 47 | |
| 48 | // JavaSource is a map of file name 'foo.java' to the source code. |
| 49 | type JavaSource map[string]string |
no test coverage detected