relaxed config scanner mode

- does not fail on MySQL 'prompt' config
This commit is contained in:
Shlomi Noach 2016-08-18 13:58:38 +02:00
parent 88eb2d6ee1
commit 00369d7e5d
2 changed files with 5 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import (
"github.com/github/gh-ost/go/sql"
"gopkg.in/gcfg.v1"
gcfgscanner "gopkg.in/gcfg.v1/scanner"
)
// RowsEstimateMethod is the type of row number estimation
@ -507,6 +508,7 @@ func (this *MigrationContext) ReadConfigFile() error {
return nil
}
gcfg.RelaxedParserMode = true
gcfgscanner.RelaxedScannerMode = true
if err := gcfg.ReadFileInto(&this.config, this.ConfigFile); err != nil {
return err
}

View File

@ -16,12 +16,12 @@ import (
"path/filepath"
"unicode"
"unicode/utf8"
)
import (
"gopkg.in/gcfg.v1/token"
)
var RelaxedScannerMode = false
// An ErrorHandler may be provided to Scanner.Init. If a syntax error is
// encountered and a handler was installed, the handler is called with a
// position and an error message. The position points to the beginning of
@ -231,7 +231,7 @@ loop:
hasCR = true
s.next()
}
if s.ch != '\n' {
if s.ch != '\n' && !RelaxedScannerMode {
s.error(offs, "unquoted '\\' must be followed by new line")
break loop
}