Switch to grafana/regexp everywhere (#10268)

Let's have a consistent library for regexp.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto 2022-02-13 00:58:27 +01:00 committed by GitHub
parent e17d6aad01
commit 9a2e93228e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 22 additions and 22 deletions

View file

@ -24,13 +24,11 @@ linters-settings:
depguard: depguard:
list-type: blacklist list-type: blacklist
include-go-root: true include-go-root: true
packages:
- sync/atomic
- github.com/stretchr/testify/assert
packages-with-error-message: packages-with-error-message:
- sync/atomic: "Use go.uber.org/atomic instead of sync/atomic" - sync/atomic: "Use go.uber.org/atomic instead of sync/atomic"
- github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" - github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert"
- github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" - github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
- regexp: "Use github.com/grafana/regexp instead of regexp"
errcheck: errcheck:
exclude: scripts/errcheck_excludes.txt exclude: scripts/errcheck_excludes.txt
goimports: goimports:

View file

@ -26,7 +26,6 @@ import (
"os" "os"
"os/signal" "os/signal"
"path/filepath" "path/filepath"
"regexp"
"runtime" "runtime"
"strings" "strings"
"sync" "sync"
@ -36,6 +35,7 @@ import (
"github.com/alecthomas/units" "github.com/alecthomas/units"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
"github.com/grafana/regexp"
conntrack "github.com/mwitkow/go-conntrack" conntrack "github.com/mwitkow/go-conntrack"
"github.com/oklog/run" "github.com/oklog/run"
"github.com/pkg/errors" "github.com/pkg/errors"

View file

@ -19,13 +19,13 @@ import (
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"strings" "strings"
"time" "time"
"github.com/alecthomas/units" "github.com/alecthomas/units"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/common/config" "github.com/prometheus/common/config"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -19,12 +19,12 @@ import (
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"testing" "testing"
"time" "time"
"github.com/alecthomas/units" "github.com/alecthomas/units"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/prometheus/common/config" "github.com/prometheus/common/config"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"

View file

@ -20,7 +20,6 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -28,6 +27,7 @@ import (
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/config" "github.com/prometheus/common/config"

View file

@ -21,12 +21,12 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/common/config" "github.com/prometheus/common/config"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -24,12 +24,12 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"path" "path"
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/common/config" "github.com/prometheus/common/config"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -16,9 +16,9 @@ package relabel
import ( import (
"crypto/md5" "crypto/md5"
"fmt" "fmt"
"regexp"
"strings" "strings"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -20,7 +20,6 @@ import (
"fmt" "fmt"
"math" "math"
"reflect" "reflect"
"regexp"
"runtime" "runtime"
"sort" "sort"
"strconv" "strconv"
@ -29,6 +28,7 @@ import (
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -15,12 +15,12 @@ package promql
import ( import (
"math" "math"
"regexp"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -17,9 +17,9 @@ import (
"context" "context"
"io/ioutil" "io/ioutil"
"os" "os"
"regexp"
"testing" "testing"
"github.com/grafana/regexp"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View file

@ -18,11 +18,11 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"math" "math"
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"

View file

@ -21,13 +21,13 @@ import (
"math" "math"
"net" "net"
"net/url" "net/url"
"regexp"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
text_template "text/template" text_template "text/template"
"time" "time"
"github.com/grafana/regexp"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"

View file

@ -15,7 +15,8 @@ package httputil
import ( import (
"net/http" "net/http"
"regexp"
"github.com/grafana/regexp"
) )
var corsHeaders = map[string]string{ var corsHeaders = map[string]string{

View file

@ -15,9 +15,9 @@ package httputil
import ( import (
"net/http" "net/http"
"regexp"
"testing" "testing"
"github.com/grafana/regexp"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View file

@ -16,10 +16,10 @@ package logging
import ( import (
"io/ioutil" "io/ioutil"
"os" "os"
"regexp"
"strings" "strings"
"testing" "testing"
"github.com/grafana/regexp"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View file

@ -15,10 +15,10 @@ package stats
import ( import (
"encoding/json" "encoding/json"
"regexp"
"testing" "testing"
"time" "time"
"github.com/grafana/regexp"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"

View file

@ -16,7 +16,8 @@ package strutil
import ( import (
"fmt" "fmt"
"net/url" "net/url"
"regexp"
"github.com/grafana/regexp"
) )
var invalidLabelCharRE = regexp.MustCompile(`[^a-zA-Z0-9_]`) var invalidLabelCharRE = regexp.MustCompile(`[^a-zA-Z0-9_]`)

View file

@ -23,7 +23,6 @@ import (
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -32,6 +31,7 @@ import (
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
"github.com/grafana/regexp"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"

View file

@ -29,7 +29,6 @@ import (
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"regexp"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
@ -39,6 +38,7 @@ import (
"github.com/alecthomas/units" "github.com/alecthomas/units"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
"github.com/grafana/regexp"
conntrack "github.com/mwitkow/go-conntrack" conntrack "github.com/mwitkow/go-conntrack"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"