From 89012244d7c764106f97d3a596471a4e247fcd73 Mon Sep 17 00:00:00 2001 From: Jordan Barrett Date: Fri, 30 Jun 2023 16:51:45 +1000 Subject: [PATCH] target.Location must always be set --- internals/plan/plan.go | 2 +- internals/plan/plan_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internals/plan/plan.go b/internals/plan/plan.go index c47e3215..d54adea4 100644 --- a/internals/plan/plan.go +++ b/internals/plan/plan.go @@ -780,7 +780,7 @@ func CombineLayers(layers ...*Layer) (*Layer, error) { } } - if target.Location == "" && len(target.Services) > 0 { + if target.Location == "" { return nil, &FormatError{ Message: fmt.Sprintf(`plan must define "location" for log target %q`, name), } diff --git a/internals/plan/plan_test.go b/internals/plan/plan_test.go index 9b0f4a7e..1883ece4 100644 --- a/internals/plan/plan_test.go +++ b/internals/plan/plan_test.go @@ -932,6 +932,7 @@ var planTests = []planTest{{ override: merge tgt2: type: syslog + location: udp://1.2.3.4:514 services: [] override: replace tgt3: @@ -1007,6 +1008,7 @@ var planTests = []planTest{{ "tgt2": { Name: "tgt2", Type: plan.SyslogTarget, + Location: "udp://1.2.3.4:514", Services: []string{}, Override: plan.ReplaceOverride, }, @@ -1052,6 +1054,7 @@ var planTests = []planTest{{ "tgt2": { Name: "tgt2", Type: plan.SyslogTarget, + Location: "udp://1.2.3.4:514", Override: plan.ReplaceOverride, }, "tgt3": {