code: func channelIntoSlice(w http.ResponseWriter, r *http.Request, from interface{}) interface{} {
  	ctx := r.Context()
  
  	var to []interface{}
  	for {
  		switch chosen, recv, ok := reflect.Select([]reflect.SelectCase{
  			{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(ctx.Done())},
  			{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(from)},
  		}); chosen {
  		case 0: // equivalent to: case <-ctx.Done()
  			http.Error(w, "Server Timeout", 504)
  			return nil
  
  		default: // equivalent to: case v, ok := <-stream
  			if !ok {
  				return to
  			}
  			v := recv.Interface()
  
  			// Render each channel item.
  			if rv, ok := v.(Renderer); ok {
  				err := renderer(w, r, rv)
  				if err != nil {
  					v = err
  				} else {
  					v = rv
  				}
  			}
  
  			to = append(to, v)
  		}
  	}
  }
docs: // channelIntoSlice buffers channel data into a slice.