code: func alloc() (int, net.Listener) {
  	for i := 0; i < attempts; i++ {
  		block := int(rand.Int31n(int32(maxBlocks)))
  		firstPort := lowPort + block*blockSize
  		ln, err := net.ListenTCP("tcp", tcpAddr("127.0.0.1", firstPort))
  		if err != nil {
  			continue
  		}
  		// log.Printf("[DEBUG] freeport: allocated port block %d (%d-%d)", block, firstPort, firstPort+blockSize-1)
  		return firstPort, ln
  	}
  	panic("freeport: cannot allocate port block")
  }
docs: // alloc reserves a port block for exclusive use for the lifetime of the
  // application. lockLn serves as a system-wide mutex for the port block and is
  // implemented as a TCP listener which is bound to the firstPort and which will
  // be automatically released when the application terminates.