Sync Prometheus Makefile.common

Fix up lint issues.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ 2022-11-29 17:41:37 +01:00
parent 6ef6e6868d
commit cba0bb6dab
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
4 changed files with 15 additions and 12 deletions

View File

@ -58,16 +58,19 @@ endif
PROMU_VERSION ?= 0.13.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.45.2
GOLANGCI_LINT_VERSION ?= v1.49.0
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
# If we're in CI and there is an Actions file, that means the linter
# is being run in Actions, so we don't need to run it here.
ifeq (,$(CIRCLE_JOB))
ifneq (,$(SKIP_GOLANGCI_LINT))
GOLANGCI_LINT :=
else ifeq (,$(CIRCLE_JOB))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint

View File

@ -15,7 +15,6 @@ package slack
import (
"fmt"
"io/ioutil"
"os"
"testing"
@ -86,7 +85,7 @@ func TestTrimmingSlackURLFromFile(t *testing.T) {
ctx, u, fn := test.GetContextWithCancelingURL()
defer fn()
f, err := ioutil.TempFile("", "slack_test_newline")
f, err := os.CreateTemp("", "slack_test_newline")
require.NoError(t, err, "creating temp file failed")
_, err = f.WriteString(u.String() + "\n\n")
require.NoError(t, err, "writing to temp file failed")

View File

@ -177,10 +177,10 @@ line`,
want: `foo="new\nline"`,
},
{
name: `foo`,
op: MatchEqual,
name: `foo`,
op: MatchEqual,
value: `tab stop`,
want: `foo="tab stop"`,
want: `foo="tab stop"`,
},
}

View File

@ -45,11 +45,12 @@ var (
// this comma and whitespace will be trimmed.
//
// Examples for valid input strings:
// {foo = "bar", dings != "bums", }
// foo=bar,dings!=bums
// foo=bar, dings!=bums
// {quote="She said: \"Hi, ladies! That's gender-neutral…\""}
// statuscode=~"5.."
//
// {foo = "bar", dings != "bums", }
// foo=bar,dings!=bums
// foo=bar, dings!=bums
// {quote="She said: \"Hi, ladies! That's gender-neutral…\""}
// statuscode=~"5.."
//
// See ParseMatcher for details on how an individual Matcher is parsed.
func ParseMatchers(s string) ([]*Matcher, error) {