From 00369d7e5db3863395ff7dc0f23fc814f177da35 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Thu, 18 Aug 2016 13:58:38 +0200 Subject: [PATCH] relaxed config scanner mode - does not fail on MySQL 'prompt' config --- go/base/context.go | 2 ++ vendor/gopkg.in/gcfg.v1/scanner/scanner.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go/base/context.go b/go/base/context.go index 4264de8..ea5ab68 100644 --- a/go/base/context.go +++ b/go/base/context.go @@ -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 } diff --git a/vendor/gopkg.in/gcfg.v1/scanner/scanner.go b/vendor/gopkg.in/gcfg.v1/scanner/scanner.go index bbbdbf5..7084c23 100644 --- a/vendor/gopkg.in/gcfg.v1/scanner/scanner.go +++ b/vendor/gopkg.in/gcfg.v1/scanner/scanner.go @@ -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 }