Randomly Allocating Port Numbers

<p>A small Go function which will return an available port number. The technique is to setup a server bound to port 0, get the port number, then shutdown the server. Not a perfect technique as there’s a tiny race condition between shutting the server down and using the port, but good enough for what I need it for.</p> <figure data-rehype-pretty-code-figure=""><pre tabindex="0" data-language="go"…