code: func (s *ReleaseServer) partition(rels []*release.Release, cap int) <-chan []*release.Release {
  	chunks := make(chan []*release.Release, 1)
  	go func() {
  		var (
  			fill = 0 // fill is space available to fill
  			size int // size is size of a release
  		)
  		var chunk []*release.Release
  		for _, rls := range rels {
  			if size = proto.Size(rls); size+fill > cap {
  				// Over-cap, push chunk onto channel to send over gRPC stream
  				s.Log("partitioned at %d with %d releases (cap=%d)", fill, len(chunk), cap)
  				chunks <- chunk
  				// reset partitioning state
  				chunk = nil
  				fill = 0
  			}
  			chunk = append(chunk, rls)
  			fill += size
  		}
  		if len(chunk) > 0 {
  			// send remaining if any
  			chunks <- chunk
  		}
  		close(chunks)
  	}()
  	return chunks
  }
docs: // partition packs releases into slices upto the capacity cap in bytes.