code: func (e *LogEntry) Validate(d *LogStreamDescriptor) error {
  	if e == nil {
  		return errors.New("entry is nil")
  	}
  
  	// Check for content.
  	switch d.StreamType {
  	case StreamType_TEXT:
  		if t := e.GetText(); t == nil || len(t.Lines) == 0 {
  			return ErrNoContent
  		}
  
  	case StreamType_BINARY:
  		if b := e.GetBinary(); b == nil || len(b.Data) == 0 {
  			return ErrNoContent
  		}
  
  	case StreamType_DATAGRAM:
  		if d := e.GetDatagram(); d == nil {
  			return ErrNoContent
  		}
  	}
  	return nil
  }
docs: // Validate checks a supplied LogEntry against its LogStreamDescriptor for
  // validity, returning an error if it is not valid.
  //
  // If the LogEntry is otherwise valid, but has no content, ErrNoContent will be
  // returned.