Skip to content

Commit

Permalink
Warn when preserve is true and the original would be overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
camdencheek committed Jul 10, 2020
1 parent 8b756aa commit 2183b9a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugin/helper/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func (c ParserConfig) Build(context plugin.BuildContext) (ParserPlugin, error) {
c.ParseTo.FieldInterface = entry.NewRecordField()
}

if c.ParseFrom.String() == c.ParseTo.String() && c.Preserve {
transformerPlugin.Warnw(
"preserve is true, but parse_to is set to the same field as parse_from, "+
"which will cause the original value to be overwritten",
"plugin_id", c.PluginID,
)
}

parserPlugin := ParserPlugin{
TransformerPlugin: transformerPlugin,
ParseFrom: c.ParseFrom,
Expand Down

0 comments on commit 2183b9a

Please sign in to comment.