Skip to content

Commit 149efd6

Browse files
committed
Use github.com/grafana/regexp instead of regexp
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
1 parent ff65168 commit 149efd6

9 files changed

Lines changed: 12 additions & 8 deletions

File tree

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ linters:
7272
desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
7373
- pkg: "io/ioutil"
7474
desc: "Use corresponding 'os' or 'io' functions instead."
75-
#- pkg: "regexp"
76-
#desc: "Use github.com/grafana/regexp instead of regexp"
75+
- pkg: "regexp"
76+
desc: "Use github.com/grafana/regexp instead of regexp"
7777
- pkg: "github.com/pkg/errors"
7878
desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors"
7979
- pkg: "gzip"

expfmt/fuzz.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
func Fuzz(in []byte) int {
3333
parser := NewTextParser(model.UTF8Validation)
3434
_, err := parser.TextToMetricFamilies(bytes.NewReader(in))
35-
3635
if err != nil {
3736
return 0
3837
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ toolchain go1.24.1
77
require (
88
github.com/alecthomas/kingpin/v2 v2.4.0
99
github.com/google/go-cmp v0.7.0
10+
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc
1011
github.com/julienschmidt/httprouter v1.3.0
1112
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
1213
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
1111
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1212
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
1313
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
14+
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248=
15+
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk=
1416
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
1517
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
1618
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=

model/labels.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ package model
1616
import (
1717
"encoding/json"
1818
"fmt"
19-
"regexp"
2019
"strings"
2120
"unicode/utf8"
21+
22+
"github.com/grafana/regexp"
2223
)
2324

2425
const (

model/metric.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import (
1717
"encoding/json"
1818
"errors"
1919
"fmt"
20-
"regexp"
2120
"sort"
2221
"strconv"
2322
"strings"
2423
"unicode/utf8"
2524

25+
"github.com/grafana/regexp"
2626
dto "github.com/prometheus/client_model/go"
2727
"google.golang.org/protobuf/proto"
2828
"gopkg.in/yaml.v2"

model/silence.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ import (
1717
"encoding/json"
1818
"errors"
1919
"fmt"
20-
"regexp"
2120
"time"
21+
22+
"github.com/grafana/regexp"
2223
)
2324

2425
// Matcher describes a matches the value of a given label.

model/value_histogram_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ package model
1616
import (
1717
"encoding/json"
1818
"reflect"
19-
"regexp"
2019
"testing"
2120

21+
"github.com/grafana/regexp"
2222
"github.com/stretchr/testify/require"
2323
)
2424

promslog/slog_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818
"context"
1919
"fmt"
2020
"log/slog"
21-
"regexp"
2221
"strings"
2322
"testing"
2423
"time"
2524

25+
"github.com/grafana/regexp"
2626
"github.com/stretchr/testify/require"
2727
"gopkg.in/yaml.v2"
2828
)

0 commit comments

Comments
 (0)