func (handler *gaugeApiMessageHandler) formatSpecs(message *gauge_messages.APIMessage) *gauge_messages.APIMessage { request := message.GetFormatSpecsRequest() results := formatter.FormatSpecFiles(request.GetSpecs()...) warnings := make([]string, 0) errors := make([]string, 0) for _, result := range results { if result.ParseError != nil { errors = append(errors, result.ParseError.Error()) } if result.Warnings != nil { warningTexts := make([]string, 0) for _, warning := range result.Warnings { warningTexts = append(warningTexts, warning.String()) } warnings = append(warnings, warningTexts...) } } formatResponse := &gauge_messages.FormatSpecsResponse{Errors: errors, Warnings: warnings} return &gauge_messages.APIMessage{MessageId: message.MessageId, MessageType: gauge_messages.APIMessage_FormatSpecsResponse.Enum(), FormatSpecsResponse: formatResponse} }