Skip to content

Commit

Permalink
Fixes linter warning from the yacc file. (#1328)
Browse files Browse the repository at this point in the history
* Fixes linter warning from the yacc file.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Improves sed to work on POSIX

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
  • Loading branch information
cyriltovena committed Nov 28, 2019
1 parent eb7b495 commit 27f17bc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 66 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ publish: dist
########

lint:
GO111MODULE=on GOGC=10 golangci-lint run
GO111MODULE=on GOGC=10 golangci-lint run -v

########
# Test #
Expand Down Expand Up @@ -262,6 +262,8 @@ ifeq ($(BUILD_IN_CONTAINER),true)
$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) $@;
else
goyacc -p $(basename $(notdir $<)) -o $@ $<
sed -i.back '/^\/\/line/ d' $@
rm ${@}.back
endif

#############
Expand Down
4 changes: 2 additions & 2 deletions cmd/fluent-bit/loki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func Test_createLine(t *testing.T) {
return
}
if tt.f == jsonFormat {
compareJson(t, got, tt.want)
compareJSON(t, got, tt.want)
} else {
if got != tt.want {
t.Errorf("createLine() = %v, want %v", got, tt.want)
Expand All @@ -151,7 +151,7 @@ func Test_createLine(t *testing.T) {

// compareJson unmarshal both string to map[string]interface compare json result.
// we can't compare string to string as jsoniter doesn't ensure field ordering.
func compareJson(t *testing.T, got, want string) {
func compareJSON(t *testing.T, got, want string) {
var w map[string]interface{}
err := jsoniter.Unmarshal([]byte(want), &w)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/chunkenc/gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ func BenchmarkHeadBlockIterator(b *testing.B) {
h := headBlock{}

for i := 0; i < j; i++ {
h.append(int64(i), "this is the append string")
if err := h.append(int64(i), "this is the append string"); err != nil {
b.Fatal(err)
}
}

b.ResetTimer()
Expand Down
1 change: 0 additions & 1 deletion pkg/loghttp/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
const (
defaultQueryLimit = 100
defaultSince = 1 * time.Hour
defaultStep = 1 // 1 seconds
)

func limit(r *http.Request) (uint32, error) {
Expand Down
53 changes: 0 additions & 53 deletions pkg/logql/expr.y.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/promtail/client/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ func TestHashCollisions(t *testing.T) {
const entriesPerLabel = 10

for i := 0; i < entriesPerLabel; i++ {
b.add(entry{labels: ls1, Entry: logproto.Entry{time.Now(), fmt.Sprintf("line %d", i)}})
b.add(entry{labels: ls2, Entry: logproto.Entry{time.Now(), fmt.Sprintf("line %d", i)}})
b.add(entry{labels: ls1, Entry: logproto.Entry{Timestamp: time.Now(), Line: fmt.Sprintf("line %d", i)}})
b.add(entry{labels: ls2, Entry: logproto.Entry{Timestamp: time.Now(), Line: fmt.Sprintf("line %d", i)}})
}

// make sure that colliding labels are stored properly as independent streams
Expand Down

0 comments on commit 27f17bc

Please sign in to comment.