diff --git a/libbeat/template/load_integration_test.go b/libbeat/template/load_integration_test.go index 63db5965f3bb..e1d6c12311a3 100644 --- a/libbeat/template/load_integration_test.go +++ b/libbeat/template/load_integration_test.go @@ -370,7 +370,7 @@ func TestESLoader_Load(t *testing.T) { require.NoError(t, err) p, ok := val.(map[string]interface{}) require.True(t, ok) - var properties []string + properties := make([]string, 0, len(p)) for k := range p { properties = append(properties, k) } diff --git a/x-pack/filebeat/input/httpjson/transform_registry.go b/x-pack/filebeat/input/httpjson/transform_registry.go index 53caa9ded4f4..26a739494db1 100644 --- a/x-pack/filebeat/input/httpjson/transform_registry.go +++ b/x-pack/filebeat/input/httpjson/transform_registry.go @@ -52,7 +52,7 @@ func (reg registry) String() string { var str string for namespace, m := range reg.namespaces { - var names []string + names := make([]string, 0, len(m)) for k := range m { names = append(names, k) }