Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Add build, tag for oniguruma, remove for mysql_go_regex, update README #660

Merged
merged 2 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ To install it, run:
go get gopkg.in/src-d/go-mysql-server.v0
```

## Regular expression engine

The **go-mysql-server** uses [oniguruma](github.com/kkos/oniguruma) as a default regular expression engine, so it's required to install the oniguruma first.
For Linux (if you have the `apt-get` tool) or OSX (if you have `homebrew` tool) the easiest way is by command:
```sh
make oniguruma # on linux you may need `sudo`
```

If you want to use regex engine from go's standard library, you have to compile **go-mysql-server** with `--tags mysql_go_regex` argument.

## Documentation

* [go-mysql-server godoc](https://godoc.org/github.com/src-d/go-mysql-server)
Expand Down
2 changes: 0 additions & 2 deletions internal/regex/regex_go.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build mysql_go_regex

package regex

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/regex/regex_oniguruma.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build oniguruma

package regex

import (
Expand Down
7 changes: 2 additions & 5 deletions internal/regex/regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ func dummy(s string) (Matcher, Disposer, error) { return nil, nil, nil }

func getDefault() string {
for _, n := range Engines() {
if n == "go" {
if n == "oniguruma" {
return n
}
}

return "oniguruma"
return "go"
}

func TestRegistration(t *testing.T) {
Expand All @@ -33,9 +33,6 @@ func TestRegistration(t *testing.T) {
engines = Engines()
require.Len(engines, number)

err = Register("oniguruma", dummy)
require.Equal(true, ErrRegexAlreadyRegistered.Is(err))

err = Register("nil", dummy)
require.NoError(err)
require.Len(Engines(), number+1)
Expand Down