From c818915ae300d0bb3211838013908a3b88bedc01 Mon Sep 17 00:00:00 2001 From: prombot Date: Mon, 19 Aug 2024 17:47:53 +0000 Subject: [PATCH 1/2] Update common Prometheus files Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- Makefile.common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 746831a..fc0f9c6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -36,4 +36,4 @@ jobs: uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: args: --verbose - version: v1.59.1 + version: v1.60.1 diff --git a/Makefile.common b/Makefile.common index e3da72a..2ecd546 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.60.1 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From c7a3f16195ecdecaf80def4fd111916a8f2de3c9 Mon Sep 17 00:00:00 2001 From: Matthias Rampke Date: Sun, 15 Sep 2024 09:16:39 +0000 Subject: [PATCH 2/2] Remove unnecessary nil checks making yet another linter happier Signed-off-by: Matthias Rampke --- pkg/mapper/fsm/dump.go | 2 +- pkg/mapper/mapper.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/mapper/fsm/dump.go b/pkg/mapper/fsm/dump.go index 35772f9..eb95b5f 100644 --- a/pkg/mapper/fsm/dump.go +++ b/pkg/mapper/fsm/dump.go @@ -35,7 +35,7 @@ func (f *FSM) DumpFSM(w io.Writer) { if idx == 0 { // color for metric types w.Write([]byte(fmt.Sprintf("%d [color=\"#D6B656\",fillcolor=\"#FFF2CC\"];\n", len(states)-1))) - } else if transition.transitions == nil || len(transition.transitions) == 0 { + } else if len(transition.transitions) == 0 { // color for end state w.Write([]byte(fmt.Sprintf("%d [color=\"#82B366\",fillcolor=\"#D5E8D4\"];\n", len(states)-1))) } diff --git a/pkg/mapper/mapper.go b/pkg/mapper/mapper.go index 52d7aac..e559201 100644 --- a/pkg/mapper/mapper.go +++ b/pkg/mapper/mapper.go @@ -201,10 +201,10 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error { if currentMapping.HistogramOptions == nil { currentMapping.HistogramOptions = &HistogramOptions{} } - if currentMapping.LegacyBuckets != nil && len(currentMapping.LegacyBuckets) != 0 { + if len(currentMapping.LegacyBuckets) != 0 { currentMapping.HistogramOptions.Buckets = currentMapping.LegacyBuckets } - if currentMapping.HistogramOptions.Buckets == nil || len(currentMapping.HistogramOptions.Buckets) == 0 { + if len(currentMapping.HistogramOptions.Buckets) == 0 { currentMapping.HistogramOptions.Buckets = n.Defaults.HistogramOptions.Buckets } } @@ -216,10 +216,10 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error { if currentMapping.SummaryOptions == nil { currentMapping.SummaryOptions = &SummaryOptions{} } - if currentMapping.LegacyQuantiles != nil && len(currentMapping.LegacyQuantiles) != 0 { + if len(currentMapping.LegacyQuantiles) != 0 { currentMapping.SummaryOptions.Quantiles = currentMapping.LegacyQuantiles } - if currentMapping.SummaryOptions.Quantiles == nil || len(currentMapping.SummaryOptions.Quantiles) == 0 { + if len(currentMapping.SummaryOptions.Quantiles) == 0 { currentMapping.SummaryOptions.Quantiles = n.Defaults.SummaryOptions.Quantiles } if currentMapping.SummaryOptions.MaxAge == 0 {