Skip to content

Commit

Permalink
move after err
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Mar 20, 2024
1 parent 069485b commit 1878d83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/stanza/operator/helper/time.go
Expand Up @@ -31,7 +31,7 @@ const NativeKey = "native" // provided for operator development
// NewTimeParser creates a new time parser with default values
func NewTimeParser() TimeParser {
return TimeParser{
LayoutType: "strptime",
LayoutType: StrptimeKey,
}
}

Expand All @@ -47,11 +47,13 @@ type TimeParser struct {

// Unmarshal starting from default settings
func (t *TimeParser) Unmarshal(component *confmap.Conf) error {
*t = NewTimeParser()
err := component.Unmarshal(t, confmap.WithIgnoreUnused())
if err != nil {
return err
}
if t.LayoutType == "" {
t.LayoutType = StrptimeKey
}
return nil
}

Expand Down

0 comments on commit 1878d83

Please sign in to comment.