Remove verbose custom type

pull/135/head
Tony 2018-12-21 14:24:46 +01:00
parent f640a5cb1b
commit 0e09297902
3 changed files with 6 additions and 16 deletions

View File

@ -26,7 +26,7 @@ func main() {
} }
if *verbose { if *verbose {
goose.SetVerbosity(goose.VerboseOn) goose.SetVerbose(true)
} }
switch args[0] { switch args[0] {

View File

@ -8,28 +8,18 @@ import (
"sync" "sync"
) )
// VerboseMode is the goose verbosity
type VerboseMode bool
const (
// VerboseOn is the goose verbose mode
VerboseOn VerboseMode = true
// VerboseOff is the goose silent mode
VerboseOff VerboseMode = false
)
var ( var (
duplicateCheckOnce sync.Once duplicateCheckOnce sync.Once
minVersion = int64(0) minVersion = int64(0)
maxVersion = int64((1 << 63) - 1) maxVersion = int64((1 << 63) - 1)
timestampFormat = "20060102150405" timestampFormat = "20060102150405"
verbose = VerboseOff verbose = false
reMatchSQLComments = regexp.MustCompile(`(--.*)`) reMatchSQLComments = regexp.MustCompile(`(--.*)`)
) )
// SetVerbosity defines the goose verbosity // SetVerbose set the goose verbosity mode
func SetVerbosity(vl VerboseMode) { func SetVerbose(v bool) {
verbose = vl verbose = v
} }
// Run runs a goose command. // Run runs a goose command.

View File

@ -202,7 +202,7 @@ func runSQLMigration(db *sql.DB, scriptFile string, v int64, direction bool) err
} }
func printInfo(s string, args ...interface{}) { func printInfo(s string, args ...interface{}) {
if verbose == VerboseOn { if verbose {
log.Printf(s, args...) log.Printf(s, args...)
} }
} }