From 0d71c267bd4be6b6d1b578f3baeda3e0fc1ecc58 Mon Sep 17 00:00:00 2001 From: freedom Date: Mon, 27 Dec 2021 09:41:20 +0800 Subject: [PATCH 1/2] add license --- dtmsvr/storage/boltdb/boltdb.go | 6 ++++++ dtmsvr/storage/boltdb/boltdb_test.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dtmsvr/storage/boltdb/boltdb.go b/dtmsvr/storage/boltdb/boltdb.go index e1af190..439cfd0 100644 --- a/dtmsvr/storage/boltdb/boltdb.go +++ b/dtmsvr/storage/boltdb/boltdb.go @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2021 yedf. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + package boltdb import ( diff --git a/dtmsvr/storage/boltdb/boltdb_test.go b/dtmsvr/storage/boltdb/boltdb_test.go index 2e96a7c..70048ea 100644 --- a/dtmsvr/storage/boltdb/boltdb_test.go +++ b/dtmsvr/storage/boltdb/boltdb_test.go @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2021 yedf. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + package boltdb import ( From d4d4ab66bb25b3914911609637bff13e26d422ac Mon Sep 17 00:00:00 2001 From: freedom Date: Mon, 27 Dec 2021 10:07:42 +0800 Subject: [PATCH 2/2] fix:Passwrod => Password --- common/config.go | 2 +- common/db.go | 2 +- dtmcli/dtmimp/types.go | 2 +- dtmcli/dtmimp/utils.go | 6 +++--- go.mod | 1 - go.sum | 9 --------- 6 files changed, 6 insertions(+), 16 deletions(-) diff --git a/common/config.go b/common/config.go index 68bf312..1c5af74 100644 --- a/common/config.go +++ b/common/config.go @@ -48,7 +48,7 @@ func (s *Store) GetDBConf() dtmcli.DBConf { Host: s.Host, Port: s.Port, User: s.User, - Passwrod: s.Password, + Password: s.Password, } } diff --git a/common/db.go b/common/db.go index 009725e..d479078 100644 --- a/common/db.go +++ b/common/db.go @@ -109,7 +109,7 @@ func DbGet(conf dtmcli.DBConf) *DB { dsn := dtmimp.GetDsn(conf) db, ok := dbs.Load(dsn) if !ok { - logger.Debugf("connecting %s", strings.Replace(dsn, conf.Passwrod, "****", 1)) + logger.Debugf("connecting %s", strings.Replace(dsn, conf.Password, "****", 1)) db1, err := gorm.Open(getGormDialetor(conf.Driver, dsn), &gorm.Config{ SkipDefaultTransaction: true, }) diff --git a/dtmcli/dtmimp/types.go b/dtmcli/dtmimp/types.go index a092295..ef7133a 100644 --- a/dtmcli/dtmimp/types.go +++ b/dtmcli/dtmimp/types.go @@ -19,5 +19,5 @@ type DBConf struct { Host string `yaml:"Host"` Port int64 `yaml:"Port"` User string `yaml:"User"` - Passwrod string `yaml:"Password"` + Password string `yaml:"Password"` } diff --git a/dtmcli/dtmimp/utils.go b/dtmcli/dtmimp/utils.go index 242089d..75b3fbd 100644 --- a/dtmcli/dtmimp/utils.go +++ b/dtmcli/dtmimp/utils.go @@ -168,7 +168,7 @@ func PooledDB(conf DBConf) (*sql.DB, error) { // StandaloneDB get a standalone db instance func StandaloneDB(conf DBConf) (*sql.DB, error) { dsn := GetDsn(conf) - Logf("opening standalone %s: %s", conf.Driver, strings.Replace(dsn, conf.Passwrod, "****", 1)) + logger.Errorf("opening standalone %s: %s", conf.Driver, strings.Replace(dsn, conf.Password, "****", 1)) return sql.Open(conf.Driver, dsn) } @@ -196,9 +196,9 @@ func GetDsn(conf DBConf) string { driver := conf.Driver dsn := map[string]string{ "mysql": fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=true&loc=Local", - conf.User, conf.Passwrod, host, conf.Port, ""), + conf.User, conf.Password, host, conf.Port, ""), "postgres": fmt.Sprintf("host=%s user=%s password=%s dbname='%s' port=%d sslmode=disable", - host, conf.User, conf.Passwrod, "", conf.Port), + host, conf.User, conf.Password, "", conf.Port), }[driver] PanicIf(dsn == "", fmt.Errorf("unknow driver: %s", driver)) return dsn diff --git a/go.mod b/go.mod index fdd8107..1457278 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,6 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/lib/pq v1.10.3 github.com/onsi/gomega v1.16.0 - github.com/polarismesh/grpc-go-polaris v0.0.0-20211128162137-1a59cd7b5733 // indirect github.com/prometheus/client_golang v1.11.0 github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.6 diff --git a/go.sum b/go.sum index 1aa3c42..560cc4b 100644 --- a/go.sum +++ b/go.sum @@ -29,7 +29,6 @@ github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935 github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -94,18 +93,12 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dtm-labs/dtmdriver v0.0.0-20211203060147-29426c663b6e h1:xXyb4mr46T5KqR5SXd37ivXNJ33k/MSAAwsGP6btmh8= -github.com/dtm-labs/dtmdriver v0.0.0-20211203060147-29426c663b6e/go.mod h1:aeo6ZWiVI0x8P8O18r6uB1cG2uw9BCQyYZaH15MlRDI= github.com/dtm-labs/dtmdriver v0.0.1 h1:dHUZQ6g2ZN6eRUqds9kKq/3K7u9bcUGatUlbthD92fA= github.com/dtm-labs/dtmdriver v0.0.1/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= -github.com/dtm-labs/dtmdriver-gozero v0.0.0-20211204083751-a14485949435 h1:qLBNU16bK1ZeaZ6tmfarf49qx9O9sUJAe7/IzoXpuEg= -github.com/dtm-labs/dtmdriver-gozero v0.0.0-20211204083751-a14485949435/go.mod h1:RYtA6oZny6LzlIRb1tPGt5bHfgqws/JaU6ogFly8ByQ= github.com/dtm-labs/dtmdriver-gozero v0.0.1 h1:ExDhMsn3MJCd+psSmIJVDgGUqbFrQGP0IpKL8x900AE= github.com/dtm-labs/dtmdriver-gozero v0.0.1/go.mod h1:uIiAMkG/Vp4jvINk5XfVMT0mSCzRqIYyXgpmqAQfqbA= github.com/dtm-labs/dtmdriver-polaris v0.0.2 h1:bh8u7bLWhairwpiA688dZMAX/OWcRoQk7a5bVcGzsjo= github.com/dtm-labs/dtmdriver-polaris v0.0.2/go.mod h1:vyXDTRj3CpROiRnI0dqM/lHFfZaKY9JAS1MSey2azIQ= -github.com/dtm-labs/dtmdriver-protocol1 v0.0.0-20211205112411-d7a7052dc90e h1:hNSfnVdE46i45HS6aneN+6umk+12EqI3AErbbzeLsoo= -github.com/dtm-labs/dtmdriver-protocol1 v0.0.0-20211205112411-d7a7052dc90e/go.mod h1:kB3NPnDKSGioVjgdfj6qgbqYJinOml45GnlHqR46Ycc= github.com/dtm-labs/dtmdriver-protocol1 v0.0.1 h1:nwGpGWi7XlUAcDhEw1qZ3TheBskqCvfE96n1uVjmDf4= github.com/dtm-labs/dtmdriver-protocol1 v0.0.1/go.mod h1:x3bRe8x7pAfHIIQBTK+LibVq96gBSzMzsgRYe85zxAc= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -509,8 +502,6 @@ github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/X github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/ychensha/dtmdriver-polaris v0.0.1 h1:+gYWFma5pflxNyV1HkcXmhzVHpijMSW9G4qTDcs63xc= -github.com/ychensha/dtmdriver-polaris v0.0.1/go.mod h1:0BdQvxXlGOlF6YVlsDoVvu8jyxdTlJZ9Kyh5t9lRA94= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=