diff --git a/migrator.go b/migrator.go index f20f767..4740a9b 100644 --- a/migrator.go +++ b/migrator.go @@ -363,7 +363,7 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, } if column.DefaultValueValue.Valid { - column.DefaultValueValue.String = regexp.MustCompile("'(.*)'::[\\w]+$").ReplaceAllString(column.DefaultValueValue.String, "$1") + column.DefaultValueValue.String = regexp.MustCompile(`'(.*)'::[\w]+$`).ReplaceAllString(column.DefaultValueValue.String, "$1") } if datetimePrecision.Valid { @@ -453,10 +453,8 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Rows, error) { name := table.(string) - if currentSchema != nil { - if _, ok := currentSchema.(string); ok { - name = fmt.Sprintf("%v.%v", currentSchema, table) - } + if _, ok := currentSchema.(string); ok { + name = fmt.Sprintf("%v.%v", currentSchema, table) } return m.DB.Session(&gorm.Session{}).Table(name).Limit(1).Rows() } diff --git a/postgres.go b/postgres.go index eae2e35..d568fd2 100644 --- a/postgres.go +++ b/postgres.go @@ -138,7 +138,7 @@ func (dialector Dialector) QuoteTo(writer clause.Writer, str string) { writer.WriteByte('"') } -var numericPlaceholder = regexp.MustCompile("\\$(\\d+)") +var numericPlaceholder = regexp.MustCompile(`\$(\d+)`) func (dialector Dialector) Explain(sql string, vars ...interface{}) string { return logger.ExplainSQL(sql, numericPlaceholder, `'`, vars...)