Changes from linter (#8769)

**What this PR does / why we need it**:
We had a few outstanding linter issues, and running `make lint` fixes
them all automatically.

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
pull/8775/head
Danny Kopping 2 years ago committed by GitHub
parent 56fbb3b771
commit e2ac2d50e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      clients/pkg/logentry/stages/stage.go
  2. 1
      clients/pkg/promtail/client/manager_test.go
  3. 1
      clients/pkg/promtail/config/config.go
  4. 1
      clients/pkg/promtail/promtail.go
  5. 2
      clients/pkg/promtail/utils/entries.go
  6. 1
      clients/pkg/promtail/utils/entries_test.go
  7. 1
      clients/pkg/promtail/wal/reader.go
  8. 1
      clients/pkg/promtail/wal/writer_test.go
  9. 3
      pkg/logql/log/ip.go
  10. 5
      pkg/logql/log/label_filter.go
  11. 3
      pkg/logql/log/parser_test.go
  12. 13
      pkg/ruler/compat.go
  13. 8
      pkg/ruler/grouploader.go
  14. 7
      pkg/ruler/grouploader_test.go
  15. 3
      pkg/ruler/memstore.go
  16. 5
      pkg/ruler/memstore_test.go

@ -38,7 +38,7 @@ const (
StageTypeStaticLabels = "static_labels"
StageTypeDecolorize = "decolorize"
StageTypeEventLogMessage = "eventlogmessage"
StageTypeGeoIP = "geoip"
StageTypeGeoIP = "geoip"
)
// Processor takes an existing set of labels, timestamp and log entry and returns either a possibly mutated
@ -219,10 +219,10 @@ func New(logger log.Logger, jobName *string, stageType string,
}
case StageTypeEventLogMessage:
s, err = newEventLogMessageStage(logger, cfg)
if err != nil {
if err != nil {
return nil, err
}
case StageTypeGeoIP:
case StageTypeGeoIP:
s, err = newGeoIPStage(logger, cfg)
if err != nil {
return nil, err

@ -16,6 +16,7 @@ import (
"github.com/grafana/loki/clients/pkg/promtail/api"
"github.com/grafana/loki/clients/pkg/promtail/wal"
"github.com/grafana/loki/pkg/logproto"
)

@ -16,6 +16,7 @@ import (
"github.com/grafana/loki/clients/pkg/promtail/server"
"github.com/grafana/loki/clients/pkg/promtail/targets/file"
"github.com/grafana/loki/clients/pkg/promtail/wal"
"github.com/grafana/loki/pkg/tracing"
"github.com/grafana/loki/pkg/util/flagext"
)

@ -23,6 +23,7 @@ import (
"github.com/grafana/loki/clients/pkg/promtail/targets/target"
"github.com/grafana/loki/clients/pkg/promtail/utils"
"github.com/grafana/loki/clients/pkg/promtail/wal"
util_log "github.com/grafana/loki/pkg/util/log"
)

@ -65,7 +65,7 @@ func (eh *FanoutEntryHandler) Chan() chan<- api.Entry {
return eh.entries
}
// Stop only stops the channel FanoutEntryHandler exposes. It then waits for the entry being processed to be sent succesfully.
// Stop only stops the channel FanoutEntryHandler exposes. It then waits for the entry being processed to be sent successfully.
// If it times out, it hard stops all sending routines.
func (eh *FanoutEntryHandler) Stop() {
eh.once.Do(func() {

@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/grafana/loki/clients/pkg/promtail/api"
"github.com/grafana/loki/pkg/logproto"
)

@ -6,6 +6,7 @@ import (
"github.com/prometheus/common/model"
"github.com/grafana/loki/clients/pkg/promtail/api"
"github.com/grafana/loki/pkg/ingester/wal"
"github.com/grafana/loki/pkg/util"
walUtils "github.com/grafana/loki/pkg/util/wal"

@ -14,6 +14,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/grafana/loki/clients/pkg/promtail/api"
"github.com/grafana/loki/pkg/logproto"
)

@ -5,9 +5,10 @@ import (
"fmt"
"unicode"
"net/netip"
"github.com/prometheus/prometheus/model/labels"
"go4.org/netipx"
"net/netip"
)
var (

@ -2,13 +2,14 @@ package log
import (
"fmt"
"github.com/dustin/go-humanize"
"github.com/prometheus/prometheus/model/labels"
"strconv"
"strings"
"time"
"unicode"
"github.com/dustin/go-humanize"
"github.com/prometheus/prometheus/model/labels"
"github.com/grafana/loki/pkg/logqlmodel"
)

@ -2,10 +2,11 @@ package log
import (
"fmt"
"github.com/grafana/loki/pkg/logqlmodel"
"sort"
"testing"
"github.com/grafana/loki/pkg/logqlmodel"
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
)

@ -7,12 +7,6 @@ import (
"time"
"github.com/go-kit/log"
"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/logql"
"github.com/grafana/loki/pkg/logql/syntax"
ruler "github.com/grafana/loki/pkg/ruler/base"
"github.com/grafana/loki/pkg/ruler/rulespb"
"github.com/grafana/loki/pkg/ruler/util"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
@ -27,6 +21,13 @@ import (
"github.com/prometheus/prometheus/rules"
"github.com/prometheus/prometheus/template"
"github.com/weaveworks/common/user"
"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/logql"
"github.com/grafana/loki/pkg/logql/syntax"
ruler "github.com/grafana/loki/pkg/ruler/base"
"github.com/grafana/loki/pkg/ruler/rulespb"
"github.com/grafana/loki/pkg/ruler/util"
)
// RulesLimits is the one function we need from limits.Overrides, and

@ -2,14 +2,16 @@ package ruler
import (
"bytes"
"github.com/grafana/loki/pkg/logql/syntax"
"os"
"sync"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/model/rulefmt"
"github.com/prometheus/prometheus/promql/parser"
"github.com/prometheus/prometheus/rules"
"gopkg.in/yaml.v3"
"os"
"sync"
"github.com/grafana/loki/pkg/logql/syntax"
)
type GroupLoader struct{}

@ -2,14 +2,15 @@ package ruler
import (
"fmt"
"os"
"strings"
"testing"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/model/rulefmt"
"github.com/prometheus/prometheus/promql/parser"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
"os"
"strings"
"testing"
)
func Test_GroupLoader(t *testing.T) {

@ -3,10 +3,11 @@ package ruler
import (
"context"
"errors"
"github.com/prometheus/prometheus/model/rulefmt"
"sync"
"time"
"github.com/prometheus/prometheus/model/rulefmt"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"

@ -2,11 +2,12 @@ package ruler
import (
"context"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/rulefmt"
"testing"
"time"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/rulefmt"
"github.com/go-kit/log"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql"

Loading…
Cancel
Save