code: func getFreePort(host string, ports ...int) (int, error) {
  	for _, port := range ports {
  		c, err := net.Listen("tcp", fmt.Sprintf("%s:%d", host, port))
  		if err == nil {
  			c.Close()
  			return port, nil
  		}
  	}
  
  	c, err := net.Listen("tcp", host+":0")
  	if err != nil {
  		return 0, err
  	}
  	addr := c.Addr().(*net.TCPAddr)
  	c.Close()
  	return addr.Port, nil
  }
docs: // tried in succession and the first to succeed is returned. If none succeed,
  // a random high port is returned.