Merge pull request #173 from github/accept-mysql-prompt-config

relaxed config scanner mode
This commit is contained in:
Shlomi Noach 2016-08-19 08:26:13 +02:00 committed by GitHub
commit 4a7df07f64
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
}