Skip to content

Commit

Permalink
Switch to grafana/regexp everywhere (prometheus#10268)
Browse files Browse the repository at this point in the history
Let's have a consistent library for regexp.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie authored Feb 12, 2022
1 parent e17d6aa commit 9a2e932
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 22 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
- sync/atomic
- github.com/stretchr/testify/assert
packages-with-error-message:
- 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/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:
exclude: scripts/errcheck_excludes.txt
goimports:
Expand Down
2 changes: 1 addition & 1 deletion cmd/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"os"
"os/signal"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
Expand All @@ -36,6 +35,7 @@ import (
"github.com/alecthomas/units"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/regexp"
conntrack "github.com/mwitkow/go-conntrack"
"github.com/oklog/run"
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"net/url"
"os"
"path/filepath"
"regexp"
"strings"
"time"

"github.com/alecthomas/units"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/common/config"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
"net/url"
"os"
"path/filepath"
"regexp"
"testing"
"time"

"github.com/alecthomas/units"
"github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/prometheus/common/config"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion discovery/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"sync"
"time"

"github.com/fsnotify/fsnotify"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/config"
Expand Down
2 changes: 1 addition & 1 deletion discovery/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"

"github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/common/config"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion discovery/puppetdb/puppetdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import (
"net/http"
"net/url"
"path"
"regexp"
"strconv"
"strings"
"time"

"github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/common/config"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion model/relabel/relabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ package relabel
import (
"crypto/md5"
"fmt"
"regexp"
"strings"

"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/common/model"

Expand Down
2 changes: 1 addition & 1 deletion promql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"
"math"
"reflect"
"regexp"
"runtime"
"sort"
"strconv"
Expand All @@ -29,6 +28,7 @@ import (

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion promql/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ package promql

import (
"math"
"regexp"
"sort"
"strconv"
"strings"
"time"

"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/common/model"

Expand Down
2 changes: 1 addition & 1 deletion promql/query_logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"context"
"io/ioutil"
"os"
"regexp"
"testing"

"github.com/grafana/regexp"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion promql/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
"fmt"
"io/ioutil"
"math"
"regexp"
"strconv"
"strings"
"time"

"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"math"
"net"
"net/url"
"regexp"
"sort"
"strconv"
"strings"
text_template "text/template"
"time"

"github.com/grafana/regexp"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
3 changes: 2 additions & 1 deletion util/httputil/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ package httputil

import (
"net/http"
"regexp"

"github.com/grafana/regexp"
)

var corsHeaders = map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion util/httputil/cors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ package httputil

import (
"net/http"
"regexp"
"testing"

"github.com/grafana/regexp"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion util/logging/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package logging
import (
"io/ioutil"
"os"
"regexp"
"strings"
"testing"

"github.com/grafana/regexp"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion util/stats/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ package stats

import (
"encoding/json"
"regexp"
"testing"
"time"

"github.com/grafana/regexp"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"

Expand Down
3 changes: 2 additions & 1 deletion util/strutil/strconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ package strutil
import (
"fmt"
"net/url"
"regexp"

"github.com/grafana/regexp"
)

var invalidLabelCharRE = regexp.MustCompile(`[^a-zA-Z0-9_]`)
Expand Down
2 changes: 1 addition & 1 deletion web/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"net/url"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
Expand All @@ -32,6 +31,7 @@ import (

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/regexp"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down
2 changes: 1 addition & 1 deletion web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"os"
"path"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
Expand All @@ -39,6 +38,7 @@ import (
"github.com/alecthomas/units"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/regexp"
conntrack "github.com/mwitkow/go-conntrack"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down

0 comments on commit 9a2e932

Please sign in to comment.