// String representation of a message
String representation of a message
// String representation of a message
func (mes *Message) String() string {
	var sb strings.Builder
	sb.WriteString(string(mes.Type))
	sb.WriteString(" - Sender: ")
	sb.WriteString(mes.SenderID)
	sb.WriteString(", Round: ")
	sb.WriteString(strconv.FormatUint(mes.Round, 10))
	sb.WriteString(", Value: ")
	sb.WriteString(mes.Value.String())
	sb.WriteString(", Justifications: ")
	if len(mes.Justifications) == 0 {
		sb.WriteString("[]\n")
	}
	currentLength := sb.Len() + 4
	for i, just := range mes.Justifications {
		if i != 0 {
			sb.WriteString(strings.Repeat(" ", currentLength))
		}
		sb.WriteString(string(just.Type))
		sb.WriteString(" - Sender: ")
		sb.WriteString(just.SenderID)
		sb.WriteString(", Round: ")
		sb.WriteString(strconv.FormatUint(just.Round, 10))
		sb.WriteString(", Value: ")
		sb.WriteString(just.Value.String())
		sb.WriteString("\n")
	}
	return sb.String()
}
func ( mes * Message ) String ( ) string { var sb strings . Builder sb . WriteString ( string ( mes . Type ) ) sb . WriteString ( " " ) sb . WriteString ( mes . SenderID ) sb . WriteString ( " " ) sb . WriteString ( strconv . FormatUint ( mes . Round , 10 ) ) sb . WriteString ( " " ) sb . WriteString ( mes . Value . String ( ) ) sb . WriteString ( " " ) if len ( mes . Justifications ) == 0 { sb . WriteString ( " \n " ) } currentLength := sb . Len ( ) + 4 for i , just := range mes . Justifications { if i != 0 { sb . WriteString ( strings . Repeat ( " " , currentLength ) ) } sb . WriteString ( string ( just . Type ) ) sb . WriteString ( " " ) sb . WriteString ( just . SenderID ) sb . WriteString ( " " ) sb . WriteString ( strconv . FormatUint ( just . Round , 10 ) ) sb . WriteString ( " " ) sb . WriteString ( just . Value . String ( ) ) sb . WriteString ( " \n " ) } return sb . String ( ) }
String representation of a message
String representation of a message