Update morph dependecy to fix a data race (#19326)
* Update morph dependecy to fix a data race * run go mod tidy
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
73d7b24745
Коммит
73ac1a354d
2
go.mod
2
go.mod
@@ -29,7 +29,7 @@ require (
|
|||||||
github.com/fsnotify/fsnotify v1.5.1
|
github.com/fsnotify/fsnotify v1.5.1
|
||||||
github.com/getsentry/sentry-go v0.11.0
|
github.com/getsentry/sentry-go v0.11.0
|
||||||
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
|
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
|
||||||
github.com/go-morph/morph v0.2.1
|
github.com/go-morph/morph v0.2.2
|
||||||
github.com/go-redis/redis/v8 v8.11.4 // indirect
|
github.com/go-redis/redis/v8 v8.11.4 // indirect
|
||||||
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
||||||
github.com/go-sql-driver/mysql v1.6.0
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
|
|||||||
8
go.sum
8
go.sum
@@ -527,12 +527,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG
|
|||||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||||
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
|
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
|
||||||
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
||||||
github.com/go-morph/morph v0.0.0-20211202070306-dbdc0736c17e h1:iS/jL0Xij+6O5d/VXrt+VOZfATHCTDIjBVVthVpHFY0=
|
github.com/go-morph/morph v0.2.2 h1:f7/+VZ+1/eR+5SUoMKYo16QQISewuvS4hogX8x/uFnA=
|
||||||
github.com/go-morph/morph v0.0.0-20211202070306-dbdc0736c17e/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
github.com/go-morph/morph v0.2.2/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
||||||
github.com/go-morph/morph v0.0.0-20220110203813-7e65a95885ea h1:l2xnsVP6YW9DZet6HfUhMKtEOPyGg2QsRyDPLECnW1o=
|
|
||||||
github.com/go-morph/morph v0.0.0-20220110203813-7e65a95885ea/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
|
||||||
github.com/go-morph/morph v0.2.1 h1:Wo+TUt4+jCwKJh57mpuRBSMioYjA2TwjQD027hhOgro=
|
|
||||||
github.com/go-morph/morph v0.2.1/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
|
||||||
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
||||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||||
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
||||||
|
|||||||
11
vendor/github.com/go-morph/morph/drivers/mysql/mysql.go
сгенерированный
поставляемый
11
vendor/github.com/go-morph/morph/drivers/mysql/mysql.go
сгенерированный
поставляемый
@@ -16,13 +16,6 @@ import (
|
|||||||
|
|
||||||
const driverName = "mysql"
|
const driverName = "mysql"
|
||||||
const defaultMigrationMaxSize = 10 * 1 << 20 // 10 MB
|
const defaultMigrationMaxSize = 10 * 1 << 20 // 10 MB
|
||||||
var defaultConfig = &Config{
|
|
||||||
Config: drivers.Config{
|
|
||||||
MigrationsTable: "db_migrations",
|
|
||||||
StatementTimeoutInSecs: 60,
|
|
||||||
MigrationMaxSize: defaultMigrationMaxSize,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// add here any custom driver configuration
|
// add here any custom driver configuration
|
||||||
var configParams = []string{
|
var configParams = []string{
|
||||||
@@ -44,7 +37,7 @@ type mysql struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error) {
|
func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error) {
|
||||||
driverConfig := mergeConfigs(config, defaultConfig)
|
driverConfig := mergeConfigs(config, getDefaultConfig())
|
||||||
|
|
||||||
conn, err := dbInstance.Conn(context.Background())
|
conn, err := dbInstance.Conn(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -69,7 +62,7 @@ func Open(connURL string) (drivers.Driver, error) {
|
|||||||
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to sanitize url from custom parameters"}
|
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to sanitize url from custom parameters"}
|
||||||
}
|
}
|
||||||
|
|
||||||
driverConfig, err := mergeConfigWithParams(customParams, defaultConfig)
|
driverConfig, err := mergeConfigWithParams(customParams, getDefaultConfig())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to merge custom params to driver config"}
|
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to merge custom params to driver config"}
|
||||||
}
|
}
|
||||||
|
|||||||
11
vendor/github.com/go-morph/morph/drivers/mysql/utils.go
сгенерированный
поставляемый
11
vendor/github.com/go-morph/morph/drivers/mysql/utils.go
сгенерированный
поставляемый
@@ -1,6 +1,7 @@
|
|||||||
package mysql
|
package mysql
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/go-morph/morph/drivers"
|
||||||
mysqlDriver "github.com/go-sql-driver/mysql"
|
mysqlDriver "github.com/go-sql-driver/mysql"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -21,3 +22,13 @@ func extractDatabaseNameFromURL(conn string) (string, error) {
|
|||||||
|
|
||||||
return cfg.DBName, nil
|
return cfg.DBName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDefaultConfig() *Config {
|
||||||
|
return &Config{
|
||||||
|
Config: drivers.Config{
|
||||||
|
MigrationsTable: "db_migrations",
|
||||||
|
StatementTimeoutInSecs: 60,
|
||||||
|
MigrationMaxSize: defaultMigrationMaxSize,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
13
vendor/github.com/go-morph/morph/drivers/postgres/postgres.go
сгенерированный
поставляемый
13
vendor/github.com/go-morph/morph/drivers/postgres/postgres.go
сгенерированный
поставляемый
@@ -14,14 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
driverName = "postgres"
|
driverName = "postgres"
|
||||||
defaultConfig = &Config{
|
|
||||||
Config: drivers.Config{
|
|
||||||
MigrationsTable: "db_migrations",
|
|
||||||
StatementTimeoutInSecs: 60,
|
|
||||||
MigrationMaxSize: defaultMigrationMaxSize,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
defaultMigrationMaxSize = 10 * 1 << 20 // 10 MB
|
defaultMigrationMaxSize = 10 * 1 << 20 // 10 MB
|
||||||
configParams = []string{
|
configParams = []string{
|
||||||
"x-migration-max-size",
|
"x-migration-max-size",
|
||||||
@@ -44,7 +37,7 @@ type postgres struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error) {
|
func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error) {
|
||||||
driverConfig := mergeConfigs(config, defaultConfig)
|
driverConfig := mergeConfigs(config, getDefaultConfig())
|
||||||
|
|
||||||
conn, err := dbInstance.Conn(context.Background())
|
conn, err := dbInstance.Conn(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -77,7 +70,7 @@ func Open(connURL string) (drivers.Driver, error) {
|
|||||||
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to sanitize url from custom parameters"}
|
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to sanitize url from custom parameters"}
|
||||||
}
|
}
|
||||||
|
|
||||||
driverConfig, err := mergeConfigWithParams(customParams, defaultConfig)
|
driverConfig, err := mergeConfigWithParams(customParams, getDefaultConfig())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to merge custom params to driver config"}
|
return nil, &drivers.AppError{Driver: driverName, OrigErr: err, Message: "failed to merge custom params to driver config"}
|
||||||
}
|
}
|
||||||
|
|||||||
16
vendor/github.com/go-morph/morph/drivers/postgres/utils.go
сгенерированный
поставляемый
16
vendor/github.com/go-morph/morph/drivers/postgres/utils.go
сгенерированный
поставляемый
@@ -1,6 +1,10 @@
|
|||||||
package postgres
|
package postgres
|
||||||
|
|
||||||
import "net/url"
|
import (
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/go-morph/morph/drivers"
|
||||||
|
)
|
||||||
|
|
||||||
func extractDatabaseNameFromURL(URL string) (string, error) {
|
func extractDatabaseNameFromURL(URL string) (string, error) {
|
||||||
uri, err := url.Parse(URL)
|
uri, err := url.Parse(URL)
|
||||||
@@ -10,3 +14,13 @@ func extractDatabaseNameFromURL(URL string) (string, error) {
|
|||||||
|
|
||||||
return uri.Path[1:], nil
|
return uri.Path[1:], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDefaultConfig() *Config {
|
||||||
|
return &Config{
|
||||||
|
Config: drivers.Config{
|
||||||
|
MigrationsTable: "db_migrations",
|
||||||
|
StatementTimeoutInSecs: 60,
|
||||||
|
MigrationMaxSize: defaultMigrationMaxSize,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
8
vendor/github.com/go-morph/morph/morph.go
сгенерированный
поставляемый
8
vendor/github.com/go-morph/morph/morph.go
сгенерированный
поставляемый
@@ -42,10 +42,6 @@ type Config struct {
|
|||||||
|
|
||||||
type EngineOption func(*Morph)
|
type EngineOption func(*Morph)
|
||||||
|
|
||||||
var defaultConfig = &Config{
|
|
||||||
Logger: log.New(os.Stderr, "", log.LstdFlags), // add default logger
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithLogger(logger *log.Logger) EngineOption {
|
func WithLogger(logger *log.Logger) EngineOption {
|
||||||
return func(m *Morph) {
|
return func(m *Morph) {
|
||||||
m.config.Logger = logger
|
m.config.Logger = logger
|
||||||
@@ -82,7 +78,9 @@ func WithLock(key string) EngineOption {
|
|||||||
// New creates a new instance of the migrations engine from an existing db instance and a migrations source.
|
// New creates a new instance of the migrations engine from an existing db instance and a migrations source.
|
||||||
func New(ctx context.Context, driver drivers.Driver, source sources.Source, options ...EngineOption) (*Morph, error) {
|
func New(ctx context.Context, driver drivers.Driver, source sources.Source, options ...EngineOption) (*Morph, error) {
|
||||||
engine := &Morph{
|
engine := &Morph{
|
||||||
config: defaultConfig,
|
config: &Config{
|
||||||
|
Logger: log.New(os.Stderr, "", log.LstdFlags), // add default logger
|
||||||
|
},
|
||||||
source: source,
|
source: source,
|
||||||
driver: driver,
|
driver: driver,
|
||||||
}
|
}
|
||||||
|
|||||||
2
vendor/modules.txt
поставляемый
2
vendor/modules.txt
поставляемый
@@ -214,7 +214,7 @@ github.com/gigawattio/window
|
|||||||
# github.com/go-asn1-ber/asn1-ber v1.5.3
|
# github.com/go-asn1-ber/asn1-ber v1.5.3
|
||||||
## explicit
|
## explicit
|
||||||
github.com/go-asn1-ber/asn1-ber
|
github.com/go-asn1-ber/asn1-ber
|
||||||
# github.com/go-morph/morph v0.2.1
|
# github.com/go-morph/morph v0.2.2
|
||||||
## explicit
|
## explicit
|
||||||
github.com/go-morph/morph
|
github.com/go-morph/morph
|
||||||
github.com/go-morph/morph/drivers
|
github.com/go-morph/morph/drivers
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user