mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Update morph dependecy to fix a data race (#19326)
* Update morph dependecy to fix a data race * run go mod tidy
This commit is contained in:
committed by
GitHub
parent
73d7b24745
commit
73ac1a354d
2
go.mod
2
go.mod
@@ -29,7 +29,7 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.5.1
|
||||
github.com/getsentry/sentry-go v0.11.0
|
||||
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-resty/resty/v2 v2.7.0 // indirect
|
||||
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.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-morph/morph v0.0.0-20211202070306-dbdc0736c17e h1:iS/jL0Xij+6O5d/VXrt+VOZfATHCTDIjBVVthVpHFY0=
|
||||
github.com/go-morph/morph v0.0.0-20211202070306-dbdc0736c17e/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-morph/morph v0.2.2 h1:f7/+VZ+1/eR+5SUoMKYo16QQISewuvS4hogX8x/uFnA=
|
||||
github.com/go-morph/morph v0.2.2/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
||||
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/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
||||
|
||||
11
vendor/github.com/go-morph/morph/drivers/mysql/mysql.go
generated
vendored
11
vendor/github.com/go-morph/morph/drivers/mysql/mysql.go
generated
vendored
@@ -16,13 +16,6 @@ import (
|
||||
|
||||
const driverName = "mysql"
|
||||
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
|
||||
var configParams = []string{
|
||||
@@ -44,7 +37,7 @@ type mysql struct {
|
||||
}
|
||||
|
||||
func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error) {
|
||||
driverConfig := mergeConfigs(config, defaultConfig)
|
||||
driverConfig := mergeConfigs(config, getDefaultConfig())
|
||||
|
||||
conn, err := dbInstance.Conn(context.Background())
|
||||
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"}
|
||||
}
|
||||
|
||||
driverConfig, err := mergeConfigWithParams(customParams, defaultConfig)
|
||||
driverConfig, err := mergeConfigWithParams(customParams, getDefaultConfig())
|
||||
if err != nil {
|
||||
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
generated
vendored
11
vendor/github.com/go-morph/morph/drivers/mysql/utils.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-morph/morph/drivers"
|
||||
mysqlDriver "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
@@ -21,3 +22,13 @@ func extractDatabaseNameFromURL(conn string) (string, error) {
|
||||
|
||||
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
generated
vendored
13
vendor/github.com/go-morph/morph/drivers/postgres/postgres.go
generated
vendored
@@ -14,14 +14,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
driverName = "postgres"
|
||||
defaultConfig = &Config{
|
||||
Config: drivers.Config{
|
||||
MigrationsTable: "db_migrations",
|
||||
StatementTimeoutInSecs: 60,
|
||||
MigrationMaxSize: defaultMigrationMaxSize,
|
||||
},
|
||||
}
|
||||
driverName = "postgres"
|
||||
defaultMigrationMaxSize = 10 * 1 << 20 // 10 MB
|
||||
configParams = []string{
|
||||
"x-migration-max-size",
|
||||
@@ -44,7 +37,7 @@ type postgres struct {
|
||||
}
|
||||
|
||||
func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error) {
|
||||
driverConfig := mergeConfigs(config, defaultConfig)
|
||||
driverConfig := mergeConfigs(config, getDefaultConfig())
|
||||
|
||||
conn, err := dbInstance.Conn(context.Background())
|
||||
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"}
|
||||
}
|
||||
|
||||
driverConfig, err := mergeConfigWithParams(customParams, defaultConfig)
|
||||
driverConfig, err := mergeConfigWithParams(customParams, getDefaultConfig())
|
||||
if err != nil {
|
||||
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
generated
vendored
16
vendor/github.com/go-morph/morph/drivers/postgres/utils.go
generated
vendored
@@ -1,6 +1,10 @@
|
||||
package postgres
|
||||
|
||||
import "net/url"
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"github.com/go-morph/morph/drivers"
|
||||
)
|
||||
|
||||
func extractDatabaseNameFromURL(URL string) (string, error) {
|
||||
uri, err := url.Parse(URL)
|
||||
@@ -10,3 +14,13 @@ func extractDatabaseNameFromURL(URL string) (string, error) {
|
||||
|
||||
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
generated
vendored
8
vendor/github.com/go-morph/morph/morph.go
generated
vendored
@@ -42,10 +42,6 @@ type Config struct {
|
||||
|
||||
type EngineOption func(*Morph)
|
||||
|
||||
var defaultConfig = &Config{
|
||||
Logger: log.New(os.Stderr, "", log.LstdFlags), // add default logger
|
||||
}
|
||||
|
||||
func WithLogger(logger *log.Logger) EngineOption {
|
||||
return func(m *Morph) {
|
||||
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.
|
||||
func New(ctx context.Context, driver drivers.Driver, source sources.Source, options ...EngineOption) (*Morph, error) {
|
||||
engine := &Morph{
|
||||
config: defaultConfig,
|
||||
config: &Config{
|
||||
Logger: log.New(os.Stderr, "", log.LstdFlags), // add default logger
|
||||
},
|
||||
source: source,
|
||||
driver: driver,
|
||||
}
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -214,7 +214,7 @@ github.com/gigawattio/window
|
||||
# github.com/go-asn1-ber/asn1-ber v1.5.3
|
||||
## explicit
|
||||
github.com/go-asn1-ber/asn1-ber
|
||||
# github.com/go-morph/morph v0.2.1
|
||||
# github.com/go-morph/morph v0.2.2
|
||||
## explicit
|
||||
github.com/go-morph/morph
|
||||
github.com/go-morph/morph/drivers
|
||||
|
||||
Reference in New Issue
Block a user