Skip to content

Commit

Permalink
Fix linter issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeschkies committed Nov 20, 2020
1 parent 08a444d commit 7be2aec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pkg/logentry/stages/multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"regexp"
"time"

"github.com/go-kit/kit/log"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/go-kit/kit/log"
"github.com/prometheus/common/model"
)

Expand All @@ -18,7 +18,7 @@ const (

const MultilineDropReason = "multiline collapse"

// MultilineConfig contains the configuration for a multilineStage
// MultilineConfig contains the configuration for a multilineStage
type MultilineConfig struct {
Expression *string `mapstructure:"firstline"`
regex *regexp.Regexp
Expand All @@ -33,7 +33,7 @@ func validateMultilineConfig(cfg *MultilineConfig) error {
if err != nil {
return errors.Errorf(ErrMultilineStageInvalidRegex, err)
}
cfg.regex = expr
cfg.regex = expr

return nil
}
Expand Down Expand Up @@ -90,4 +90,4 @@ func (m *multilineStage) Process(labels model.LabelSet, extracted map[string]int
// Name implements Stage
func (m *multilineStage) Name() string {
return StageTypeMultiline
}
}
11 changes: 7 additions & 4 deletions pkg/logentry/stages/multiline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ import (
"github.com/stretchr/testify/require"
ww "github.com/weaveworks/common/server"
)

func Test_multilineStage_Process(t *testing.T) {
// Enable debug logging
cfg := &ww.Config{}
require.Nil(t, cfg.LogLevel.Set("debug"))
util.InitLogger(cfg)
Debug = true

mcfg := &MultilineConfig{Expression: ptrFromString("^START"),}
validateMultilineConfig(mcfg)
mcfg := &MultilineConfig{Expression: ptrFromString("^START")}
err := validateMultilineConfig(mcfg)
require.NoError(t, err)

stage := &multilineStage{
cfg: mcfg,
cfg: mcfg,
logger: util.Logger,
buffer: new(bytes.Buffer),
}
Expand All @@ -37,4 +40,4 @@ func Test_multilineStage_Process(t *testing.T) {
stage.Process(model.LabelSet{}, map[string]interface{}{}, ptrFromTime(time.Now()), &nextStart)

require.Equal(t, "START line 2", nextStart)
}
}

0 comments on commit 7be2aec

Please sign in to comment.