(port int)
| 18 | } |
| 19 | |
| 20 | func IsPortAvailable(port int) bool { |
| 21 | timeout := time.Second |
| 22 | conn, err := net.DialTimeout("tcp", net.JoinHostPort("localhost", fmt.Sprintf("%d", port)), timeout) |
| 23 | if err != nil { |
| 24 | return true |
| 25 | } |
| 26 | if conn != nil { |
| 27 | conn.Close() |
| 28 | return false |
| 29 | } |
| 30 | return true |
| 31 | } |
no outgoing calls
no test coverage detected