all: replace regexp with grafana/regexp (#30948)

grafana/regexp's speedup branch contains the stdlib regexp with multiple
patches applied to speed up regexp. The benchmark improvements are quite
impressive across the board. The series of patches are being considered
for inclusion in golang. I took a look over them, and they look legit
enough for us to start using it.

This commit replaces all uses of regexp with grafana/regexp. This
replacement was done via a simple string replace on

  ^\s*"regexp"

Followed by goimports -w across the repository. I then manually
inspected each result to ensure it was on an import.
This commit is contained in:
Keegan Carruthers-Smith 2022-02-14 11:08:21 +02:00 committed by GitHub
parent 5b93082a8b
commit 039b26201f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 168 additions and 112 deletions

View File

@ -28,6 +28,8 @@ linters-settings:
- github.com/pkg/errors: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
- github.com/cockroachdb/errors: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
- github.com/hashicorp/go-multierror: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
# More performant regexp
- regexp: "Use github.com/grafana/regexp instead"
gocritic:
disabled-checks:
- appendAssign # Too many false positives

View File

@ -7,10 +7,11 @@ import (
"io"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/cmd/frontend/envvar"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/api/internalapi"

View File

@ -5,13 +5,13 @@ import (
"encoding/json"
"fmt"
"math"
"regexp"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/neelance/parallel"
"github.com/opentracing/opentracing-go"

View File

@ -7,10 +7,11 @@ import (
"net/http"
"net/url"
"path"
"regexp"
"strconv"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/cmd/frontend/backend"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/cloneurls"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -9,12 +9,12 @@ import (
"net/http/httputil"
"net/url"
"os"
"regexp"
"strconv"
"strings"
"time"
"github.com/gorilla/mux"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"

View File

@ -1,7 +1,7 @@
package markdown
import (
"regexp"
"regexp" //nolint:depguard // bluemonday requires this pkg
"sync"
"github.com/microcosm-cc/bluemonday"

View File

@ -4,10 +4,10 @@ import (
"net/http"
"net/url"
"reflect"
"regexp"
"testing"
"github.com/gorilla/mux"
"github.com/grafana/regexp"
)
func TestRepoPattern(t *testing.T) {

View File

@ -4,13 +4,13 @@ import (
"bytes"
"context"
"io"
"regexp"
"regexp/syntax"
"strings"
"sync"
"time"
"unicode/utf8"
"github.com/grafana/regexp"
"github.com/grafana/regexp/syntax"
"github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"
"go.uber.org/atomic"

View File

@ -6,13 +6,14 @@ import (
"context"
"os"
"reflect"
"regexp"
"regexp/syntax"
"sort"
"strconv"
"testing"
"testing/iotest"
"github.com/grafana/regexp"
"github.com/grafana/regexp/syntax"
"github.com/sourcegraph/sourcegraph/cmd/searcher/protocol"
"github.com/sourcegraph/sourcegraph/internal/pathmatch"
"github.com/sourcegraph/sourcegraph/internal/store"

View File

@ -4,7 +4,7 @@ import (
"archive/zip"
"context"
"io"
"regexp/syntax"
"regexp/syntax" //nolint:depguard // zoekt requires this pkg
"sync"
"sync/atomic"
"time"

View File

@ -2,8 +2,8 @@ package database
import (
"database/sql"
"regexp"
"github.com/grafana/regexp"
"github.com/mattn/go-sqlite3"
)

View File

@ -3,9 +3,9 @@ package store
import (
"context"
"database/sql"
"regexp/syntax"
"strings"
"github.com/grafana/regexp/syntax"
"github.com/keegancsmith/sqlf"
"github.com/sourcegraph/sourcegraph/cmd/symbols/internal/types"

View File

@ -2,7 +2,8 @@ package main
import (
"os"
"regexp"
"github.com/grafana/regexp"
)
var indexFilenamePattern = regexp.MustCompile(`^(.+)\.\d+\.([0-9A-Fa-f]{40})\.dump$`)

View File

@ -5,9 +5,10 @@ import (
"fmt"
"os"
"path/filepath"
"regexp"
"sort"
"strings"
"github.com/grafana/regexp"
)
const rootPackage = "github.com/sourcegraph/sourcegraph"

View File

@ -4,8 +4,9 @@ import (
"bytes"
"os"
"path/filepath"
"regexp"
"sort"
"github.com/grafana/regexp"
)
// parseNames returns a map from package paths to the name declared by that package.

View File

@ -1,9 +1,10 @@
package lints
import (
"regexp"
"sort"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/dev/depgraph/internal/graph"
)

View File

@ -4,9 +4,10 @@ import (
"bytes"
"fmt"
"path/filepath"
"regexp"
"sort"
"strings"
"github.com/grafana/regexp"
)
// Dotify serializes the given package and edge data into a DOT-formatted graph.

View File

@ -8,13 +8,13 @@ import (
"log"
"os"
"os/exec"
"regexp"
"runtime"
"sort"
"strings"
"sync"
"time"
"github.com/grafana/regexp"
"github.com/lib/pq"
_ "github.com/lib/pq"
"golang.org/x/sync/errgroup"

View File

@ -1,8 +1,9 @@
package bk
import (
"regexp"
"strings"
"github.com/grafana/regexp"
)
// CleanANSI cleans up Buildkite log output markup.

View File

@ -8,9 +8,10 @@ import (
"io"
"net/http"
"net/url"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/bk"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -7,11 +7,12 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/db"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/run"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/stdout"

View File

@ -4,9 +4,9 @@ import (
"context"
"fmt"
"net/http"
"regexp"
"strings"
"github.com/grafana/regexp"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/drive/v3"

View File

@ -8,11 +8,11 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"sync"
"time"
"github.com/grafana/regexp"
"github.com/rjeczalik/notify"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/stdout"

View File

@ -8,7 +8,6 @@ import (
"net/url"
"os"
"os/exec"
"regexp"
"strings"
"time"
@ -16,6 +15,7 @@ import (
"github.com/buildkite/go-buildkite/v3/buildkite"
"github.com/gen2brain/beeep"
"github.com/grafana/regexp"
"github.com/peterbourgon/ff/v3/ffcli"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/bk"

View File

@ -4,10 +4,10 @@ package resolvers
import (
"context"
"regexp"
"sync"
"time"
regexp "github.com/grafana/regexp"
enqueuer "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/autoindex/enqueuer"
dbstore "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
lsifstore "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/lsifstore"

View File

@ -6,9 +6,9 @@ import (
"fmt"
"io"
"net/http"
"regexp"
"github.com/gorilla/mux"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
apiclient "github.com/sourcegraph/sourcegraph/enterprise/internal/executor"

View File

@ -8,10 +8,10 @@ import (
"fmt"
"net/url"
"os"
"regexp"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
authzGitHub "github.com/sourcegraph/sourcegraph/enterprise/internal/authz/github"
edb "github.com/sourcegraph/sourcegraph/enterprise/internal/database"

View File

@ -2,9 +2,10 @@ package indexing
import (
"context"
"regexp"
"time"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/policies"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -4,10 +4,10 @@ package indexing
import (
"context"
"regexp"
"sync"
"time"
regexp "github.com/grafana/regexp"
policies "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/policies"
dbstore "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
api "github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -9,10 +9,11 @@ import (
"io"
"log"
"os"
"regexp"
"strings"
"time"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/dev/ci/runtype"
"github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/buildkite"
"github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/ci"

View File

@ -11,11 +11,11 @@ import (
"fmt"
"io"
"os"
"regexp"
"strconv"
"strings"
"github.com/ghodss/yaml"
"github.com/grafana/regexp"
)
type featureFlags struct {

View File

@ -2,7 +2,8 @@ package operations
import (
"fmt"
"regexp"
"github.com/grafana/regexp"
bk "github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/buildkite"
)

View File

@ -3,8 +3,9 @@ package syntax
import (
"bytes"
"fmt"
"regexp"
"strings"
"github.com/grafana/regexp"
)
// The parse tree for search input. It is a list of expressions.

View File

@ -5,11 +5,11 @@ import (
"fmt"
"os"
"path"
"regexp"
"sort"
"sync"
"github.com/gobwas/glob"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/enterprise/internal/batches/store"
btypes "github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types"

View File

@ -6,12 +6,12 @@ import (
"net/http"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
"github.com/dnaeon/go-vcr/cassette"
"github.com/dnaeon/go-vcr/recorder"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/internal/extsvc"

View File

@ -1,8 +1,7 @@
package store
import (
"regexp"
"github.com/grafana/regexp"
"github.com/keegancsmith/sqlf"
"github.com/sourcegraph/sourcegraph/enterprise/internal/batches/search"

View File

@ -3,11 +3,11 @@ package enqueuer
import (
"context"
"fmt"
"regexp"
"sort"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"golang.org/x/time/rate"
store "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"

View File

@ -2,7 +2,8 @@ package enqueuer
import (
"context"
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -4,9 +4,9 @@ package enqueuer
import (
"context"
"regexp"
"sync"
regexp "github.com/grafana/regexp"
dbstore "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
api "github.com/sourcegraph/sourcegraph/internal/api"
basestore "github.com/sourcegraph/sourcegraph/internal/database/basestore"

View File

@ -3,9 +3,9 @@ package gitserver
import (
"context"
"os"
"regexp"
"time"
"github.com/grafana/regexp"
"github.com/opentracing/opentracing-go/log"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -3,9 +3,10 @@ package compute
import (
"context"
"fmt"
"regexp"
"strconv"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/search/result"
)

View File

@ -2,10 +2,11 @@ package compute
import (
"encoding/json"
"regexp"
"testing"
"github.com/grafana/regexp"
"github.com/hexops/autogold"
"github.com/sourcegraph/sourcegraph/internal/search/result"
)

View File

@ -3,9 +3,10 @@ package compute
import (
"context"
"fmt"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/authz"
"github.com/sourcegraph/sourcegraph/internal/comby"
"github.com/sourcegraph/sourcegraph/internal/search/result"

View File

@ -3,9 +3,9 @@ package compute
import (
"context"
"os"
"regexp"
"testing"
"github.com/grafana/regexp"
"github.com/hexops/autogold"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -2,7 +2,8 @@ package compute
import (
"fmt"
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/lazyregexp"
"github.com/sourcegraph/sourcegraph/internal/search/query"

View File

@ -3,10 +3,11 @@ package compute
import (
"context"
"os"
"regexp"
"testing"
"github.com/grafana/regexp"
"github.com/hexops/autogold"
"github.com/sourcegraph/sourcegraph/internal/comby"
)

View File

@ -4,11 +4,11 @@ import (
"context"
"encoding/json"
"fmt"
"regexp"
"strings"
"sync"
"time"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/opentracing/opentracing-go/log"
"github.com/prometheus/client_golang/prometheus"

View File

@ -3,11 +3,11 @@ package query
import (
"context"
"fmt"
"regexp"
"sort"
"strings"
"time"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/enterprise/internal/insights/compression"

View File

@ -3,11 +3,11 @@ package resolvers
import (
"context"
"fmt"
"regexp"
"sort"
"sync"
"time"
"github.com/grafana/regexp"
"github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
"github.com/inconshreveable/log15"

3
go.mod
View File

@ -77,6 +77,7 @@ require (
github.com/gorilla/sessions v1.2.1
github.com/goware/urlx v0.3.1
github.com/grafana-tools/sdk v0.0.0-20220203092117-edae16afa87b
github.com/grafana/regexp v0.0.0-20220202152701-6a046c4caf32
github.com/graph-gophers/graphql-go v1.3.0
github.com/graphql-go/graphql v0.8.0
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
@ -392,7 +393,7 @@ require (
// or intentional forks.
replace (
// We maintain our own fork of Zoekt. Update with ./dev/zoekt/update
github.com/google/zoekt => github.com/sourcegraph/zoekt v0.0.0-20220210200412-9d1b56e6180f
github.com/google/zoekt => github.com/sourcegraph/zoekt v0.0.0-20220211090549-756e833d8ebe
// We use a fork of Alertmanager to allow prom-wrapper to better manipulate Alertmanager configuration.
// See https://docs.sourcegraph.com/dev/background-information/observability/prometheus
github.com/prometheus/alertmanager => github.com/sourcegraph/alertmanager v0.21.1-0.20211110092431-863f5b1ee51b

6
go.sum
View File

@ -858,6 +858,8 @@ github.com/goware/urlx v0.3.1 h1:BbvKl8oiXtJAzOzMqAQ0GfIhf96fKeNEZfm9ocNSUBI=
github.com/goware/urlx v0.3.1/go.mod h1:h8uwbJy68o+tQXCGZNa9D73WN8n0r9OBae5bUnLcgjw=
github.com/grafana-tools/sdk v0.0.0-20220203092117-edae16afa87b h1:R9LID2XreyUOQfJ/NKLGuYOF4/Wz6ljmYFAhlOaHVQ4=
github.com/grafana-tools/sdk v0.0.0-20220203092117-edae16afa87b/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4=
github.com/grafana/regexp v0.0.0-20220202152701-6a046c4caf32 h1:M3wP8Hwic62qJsiydSgXtev03d4f92uN1I52nVjRgw0=
github.com/grafana/regexp v0.0.0-20220202152701-6a046c4caf32/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A=
github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0=
github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/graphql-go/graphql v0.8.0 h1:JHRQMeQjofwqVvGwYnr8JnPTY0AxgVy1HpHSGPLdH0I=
@ -1489,8 +1491,8 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152 h1:z/MpntplPaW6QW95pzcAR/72Z5TWDyDnSo0EOcyij9o=
github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
github.com/sourcegraph/zoekt v0.0.0-20220210200412-9d1b56e6180f h1:jBnIBqQsyTfPJ0ahWXQbRdGcSllkuhqbzCfw86AuD6Y=
github.com/sourcegraph/zoekt v0.0.0-20220210200412-9d1b56e6180f/go.mod h1:Dx/yL46cfqqppDnXA6XwNlWi/++l+WIGs8AkJIo9cDI=
github.com/sourcegraph/zoekt v0.0.0-20220211090549-756e833d8ebe h1:Eh4QsOq1jXT3RCwflCxHIGGvFEylFYoqZnxiK2ED1wo=
github.com/sourcegraph/zoekt v0.0.0-20220211090549-756e833d8ebe/go.mod h1:7ch4x99rdVR1l7wn4D/LIK4q+0bkXhJUC8C37QISsDY=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=

View File

@ -1,9 +1,10 @@
package main
import (
"regexp"
"sort"
"strings"
"github.com/grafana/regexp"
)
// Emojis returns a string of emojis that should be displayed with an issue or a pull request.

View File

@ -1,10 +1,11 @@
package main
import (
"regexp"
"strings"
"sync"
"time"
"github.com/grafana/regexp"
)
// Issue represents an existing GitHub Issue.

View File

@ -2,10 +2,11 @@ package main
import (
"fmt"
"regexp"
"sort"
"strconv"
"strings"
"github.com/grafana/regexp"
)
// RenderTrackingIssue renders the work section of the given tracking issue.

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -1,10 +1,11 @@
package comby
import (
"regexp"
"strings"
"unicode/utf8"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/lazyregexp"
)

View File

@ -2,9 +2,10 @@ package reposource
import (
"net/url"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/extsvc"
"github.com/sourcegraph/sourcegraph/internal/lazyregexp"

View File

@ -2,9 +2,9 @@ package reposource
import (
"fmt"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -1,9 +1,10 @@
package reposource
import (
"regexp"
"testing"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/api"
)

View File

@ -4,9 +4,10 @@ import (
"encoding/json"
"fmt"
"net/url"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/conf/conftypes"
)

View File

@ -7,11 +7,11 @@ import (
"fmt"
"net"
"os"
regexpsyntax "regexp/syntax"
"strconv"
"strings"
"time"
regexpsyntax "github.com/grafana/regexp/syntax"
"github.com/inconshreveable/log15"
"github.com/keegancsmith/sqlf"
"github.com/lib/pq"

View File

@ -3,7 +3,8 @@ package github
import (
"flag"
"os"
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/extsvc/auth"
)

View File

@ -5,10 +5,10 @@ import (
"flag"
"net/url"
"os"
"regexp"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/httptestutil"
)

View File

@ -8,9 +8,10 @@ package lazyregexp
import (
"os"
"regexp"
"strings"
"sync"
"github.com/grafana/regexp"
)
// Regexp is a wrapper around regexp.Regexp, where the underlying regexp will be

View File

@ -5,10 +5,10 @@ package pathmatch
import (
"bytes"
"fmt"
"regexp"
"strings"
"github.com/gobwas/glob"
"github.com/grafana/regexp"
)
// PathMatcher reports whether the path was matched.

View File

@ -1,8 +1,9 @@
package repos
import (
"regexp"
"strings"
"github.com/grafana/regexp"
)
// excludeFunc takes a string and returns true if it should be excluded. In

View File

@ -3,9 +3,10 @@ package repos
import (
"flag"
"os"
"regexp"
"testing"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
)

View File

@ -4,11 +4,11 @@ import (
"container/heap"
"context"
"math/rand"
"regexp"
"strings"
"sync"
"time"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -8,7 +8,6 @@ import (
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
@ -17,6 +16,7 @@ import (
"github.com/dnaeon/go-vcr/cassette"
"github.com/dnaeon/go-vcr/recorder"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -3,11 +3,12 @@ package backend
import (
"bytes"
"encoding/json"
"regexp"
"sort"
"github.com/google/zoekt"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/schema"
)

View File

@ -1,9 +1,10 @@
package casetransform
import (
"regexp/syntax"
"unicode"
"unicode/utf8"
"github.com/grafana/regexp/syntax"
)
// LowerRegexpASCII lowers rune literals and expands char classes to include

View File

@ -1,8 +1,9 @@
package casetransform
import (
"regexp/syntax"
"testing"
"github.com/grafana/regexp/syntax"
)
func TestLowerRegexpASCII(t *testing.T) {

View File

@ -1,8 +1,8 @@
package casetransform
import (
"regexp"
"regexp/syntax"
"github.com/grafana/regexp"
"github.com/grafana/regexp/syntax"
)
// Regexp is a light wrapper over *regexp.Regexp that optimizes for case-insensitive search.

View File

@ -2,10 +2,10 @@ package commit
import (
"context"
"regexp"
"strings"
"time"
"github.com/grafana/regexp"
"github.com/opentracing/opentracing-go/log"
"github.com/sourcegraph/sourcegraph/internal/conf"

View File

@ -1,9 +1,10 @@
package query
import (
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -2,9 +2,10 @@ package query
import (
"fmt"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/lazyregexp"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -2,11 +2,11 @@ package query
import (
"encoding/json"
"regexp"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"github.com/hexops/autogold"
)

View File

@ -2,9 +2,10 @@ package query
import (
"fmt"
"regexp"
"strconv"
"time"
"github.com/grafana/regexp"
)
type ExpectedOperand struct {

View File

@ -1,12 +1,12 @@
package query
import (
"regexp"
"strconv"
"strings"
"time"
"github.com/go-enry/go-enry/v2"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/search/filter"
"github.com/sourcegraph/sourcegraph/lib/errors"

View File

@ -1,8 +1,9 @@
package query
import (
"regexp"
"strconv"
"github.com/grafana/regexp"
)
// ValueType is the set of types of values in queries.

View File

@ -1,14 +1,14 @@
package search
import (
"regexp"
"regexp/syntax"
"regexp/syntax" //nolint:depguard // zoekt requires this pkg
"strconv"
"strings"
"time"
"github.com/go-enry/go-enry/v2"
"github.com/go-enry/go-enry/v2/data"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/search/filter"

View File

@ -3,13 +3,13 @@ package repos
import (
"context"
"fmt"
"regexp"
regexpsyntax "regexp/syntax"
"sort"
"strconv"
"strings"
"sync"
"github.com/grafana/regexp"
regexpsyntax "github.com/grafana/regexp/syntax"
"github.com/inconshreveable/log15"
otlog "github.com/opentracing/opentracing-go/log"
"golang.org/x/sync/errgroup"

View File

@ -3,10 +3,10 @@ package searchcontexts
import (
"context"
"fmt"
"regexp"
"strings"
"sync"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"golang.org/x/sync/errgroup"
"golang.org/x/sync/semaphore"

View File

@ -3,10 +3,11 @@ package streaming
import (
"fmt"
"path"
"regexp"
"strconv"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/inventory"
"github.com/sourcegraph/sourcegraph/internal/lazyregexp"

View File

@ -3,14 +3,14 @@ package symbol
import (
"context"
"fmt"
"regexp"
"regexp/syntax"
"regexp/syntax" //nolint:depguard // zoekt requires this pkg
"sort"
"time"
"github.com/RoaringBitmap/roaring"
"github.com/google/zoekt"
zoektquery "github.com/google/zoekt/query"
"github.com/grafana/regexp"
"github.com/neelance/parallel"
"github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"

View File

@ -2,7 +2,7 @@ package zoekt
import (
"context"
"regexp/syntax"
"regexp/syntax" //nolint:depguard // zoekt requires this pkg
"time"
"github.com/google/zoekt"

View File

@ -1,9 +1,8 @@
package zoekt
import (
"regexp"
zoektquery "github.com/google/zoekt/query"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/search"
"github.com/sourcegraph/sourcegraph/internal/search/query"

View File

@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"regexp"
"sort"
"strconv"
"testing"
@ -15,6 +14,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/observation"
"github.com/sourcegraph/sourcegraph/lib/errors"

View File

@ -8,7 +8,6 @@ import (
"os"
stdlibpath "path"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
@ -16,6 +15,7 @@ import (
"time"
"github.com/golang/groupcache/lru"
"github.com/grafana/regexp"
"gopkg.in/src-d/go-git.v4/plumbing/format/config"
"github.com/sourcegraph/sourcegraph/internal/actor"

View File

@ -7,13 +7,13 @@ import (
"os"
"path/filepath"
"reflect"
"regexp"
"runtime"
"sort"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -19,9 +19,10 @@ package vcs
import (
"fmt"
"net/url"
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -6,11 +6,11 @@ import (
"database/sql/driver"
"encoding/json"
"fmt"
"regexp"
"strings"
"time"
"github.com/derision-test/glock"
"github.com/grafana/regexp"
"github.com/inconshreveable/log15"
"github.com/keegancsmith/sqlf"
"github.com/opentracing/opentracing-go/log"

View File

@ -2,7 +2,8 @@ package inference
import (
"context"
"regexp"
"github.com/grafana/regexp"
)
type GitClient interface {

View File

@ -2,7 +2,8 @@ package inference
import (
"path/filepath"
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/codeintel/autoindex/config"
)

View File

@ -2,9 +2,10 @@ package inference
import (
"fmt"
"regexp"
"strings"
"testing"
"github.com/grafana/regexp"
)
type PathTestCase = struct {

View File

@ -1,9 +1,10 @@
package inference
import (
"regexp"
"strings"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/codeintel/autoindex/config"
)

View File

@ -4,8 +4,9 @@ package inference
import (
"context"
"regexp"
"sync"
"github.com/grafana/regexp"
)
// MockGitClient is a mock implementation of the GitClient interface (from

View File

@ -1,8 +1,9 @@
package inference
import (
"regexp"
"strings"
"github.com/grafana/regexp"
)
// Patterns is a regular expression that matches any input that would also match

View File

@ -1,7 +1,7 @@
package inference
import (
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/codeintel/autoindex/config"
)

View File

@ -2,7 +2,8 @@ package inference
import (
"path/filepath"
"regexp"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/lib/codeintel/autoindex/config"
)

Some files were not shown because too many files have changed in this diff Show More