From e6ca59edad1aeae6a2647efc5e709a475b0d7c7b Mon Sep 17 00:00:00 2001 From: Noly Date: Fri, 9 Oct 2020 10:26:02 +0200 Subject: [PATCH] refactor: move slide const out func to improve performance --- pkg/integrations/v4/protocol/types.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/integrations/v4/protocol/types.go b/pkg/integrations/v4/protocol/types.go index 129d4a3ea..54b279ea4 100644 --- a/pkg/integrations/v4/protocol/types.go +++ b/pkg/integrations/v4/protocol/types.go @@ -23,6 +23,8 @@ const ( const millisSinceJanuaryFirst1978 = 252489600000 +var acceptedAttribute = []string{"summary", "category", "entity_name", "format", "local_identity", "local_details"} + type DataV4 struct { PluginProtocolVersion Integration IntegrationMetadata `json:"integration"` @@ -158,7 +160,6 @@ func NewEventData(options ...func(EventData)) (EventData, error) { // valid keys: ["summary", "category", "entity_name", "format", "local_identity", "local_details"] func WithEvents(original EventData) func(EventData) { return func(copy EventData) { - acceptedAttribute := []string{"summary", "category", "entity_name", "format", "local_identity", "local_details"} for _, key := range acceptedAttribute { if val, ok := original[key]; ok { copy[key] = val