code: func (b *Batch) CallTimeout(timeout time.Duration) error {
  	b.opsLock.Lock()
  	ops := b.ops
  	b.ops = nil
  	b.opsLock.Unlock()
  
  	results := make([]*AsyncResult, len(ops))
  	for i := range ops {
  		op := ops[i]
  		m, err := callAsyncRetry(b.c, op.request, op.done == nil, 5)
  		if err != nil {
  			return err
  		}
  		results[i] = m
  	}
  
  	t := acquireTimer(timeout)
  
  	for i := range results {
  		m := results[i]
  		op := ops[i]
  		if op.done == nil {
  			continue
  		}
  
  		select {
  		case <-m.Done:
  			op.Response, op.Error = m.Response, m.Error
  			close(op.done)
  		case <-t.C:
  			releaseTimer(t)
  			err := getClientTimeoutError(b.c, timeout)
  			for ; i < len(results); i++ {
  				results[i].Cancel()
  				op = ops[i]
  				op.Error = err
  				if op.done != nil {
  					close(op.done)
  				}
  			}
  			return err
  		}
  	}
  
  	releaseTimer(t)
  
  	return nil
  }
docs: // CallTimeout calls all the RPCs added via Batch.Add() and waits for
  // all the RPC responses during the given timeout.
  //
  // The order of batched RPCs execution on the server is unspecified.
  // Usually batched RPCs are executed concurrently on the server.
  //
  // The caller may read all BatchResult contents returned from Batch.Add()
  // after the CallTimeout returns.
  //
  // It is guaranteed that all <-BatchResult.Done channels are unblocked after
  // the CallTimeout returns.