From 7545784a49226fe4d8db9b82dfc0c24f0a685b51 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 10 Mar 2020 19:39:55 +0200 Subject: [PATCH] all: fix `golangci-lint` issues --- lib/backup/fsnil/fsnil.go | 4 +--- lib/persistentqueue/fastqueue_test.go | 2 +- lib/promscrape/config.go | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/backup/fsnil/fsnil.go b/lib/backup/fsnil/fsnil.go index 235b97076..456a1e0c3 100644 --- a/lib/backup/fsnil/fsnil.go +++ b/lib/backup/fsnil/fsnil.go @@ -1,8 +1,6 @@ package fsnil import ( - "fmt" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/common" ) @@ -11,7 +9,7 @@ type FS struct{} // String returns human-readable string representation for fs. func (fs *FS) String() string { - return fmt.Sprintf("fsnil") + return "fsnil" } // ListParts returns all the parts from fs. diff --git a/lib/persistentqueue/fastqueue_test.go b/lib/persistentqueue/fastqueue_test.go index 1b5f727a9..33274d3b1 100644 --- a/lib/persistentqueue/fastqueue_test.go +++ b/lib/persistentqueue/fastqueue_test.go @@ -155,7 +155,7 @@ func TestFastQueueReadUnblockByWrite(t *testing.T) { mustDeleteDir(path) fq := MustOpenFastQueue(path, "foobar", 13, 0) - block := fmt.Sprintf("foodsafdsaf sdf") + block := "foodsafdsaf sdf" resultCh := make(chan error) go func() { data, ok := fq.MustReadBlock(nil) diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go index 36a28c896..a5477759b 100644 --- a/lib/promscrape/config.go +++ b/lib/promscrape/config.go @@ -187,8 +187,9 @@ func (sc *ScrapeConfig) appendFileSDScrapeWork(dst, prev []ScrapeWork, baseDir s label := promrelabel.GetLabelByName(sw.Labels, "__meta_filepath") if label == nil { logger.Panicf("BUG: missing `__meta_filepath` label") + } else { + swPrev[label.Value] = append(swPrev[label.Value], *sw) } - swPrev[label.Value] = append(swPrev[label.Value], *sw) } for i := range sc.FileSDConfigs { var err error