Documentation ¶ Index ¶ func FreePort(preferred int) (int, error) Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func FreePort ¶ func FreePort(preferred int) (int, error) FreePort returns a free port on localhost. It first tries the preferred port; if that is already in use it asks the OS to assign one by listening on :0 and reads the port back from the resulting address. Types ¶ This section is empty. Source Files ¶ View all Source files port.go Click to show internal directories. Click to hide internal directories.