Skip to content

refactor: modify the form of variable declarations #822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/go-binlogparser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
"github.com/go-mysql-org/go-mysql/replication"
)

var name = flag.String("name", "", "binlog file name")
var offset = flag.Int64("offset", 0, "parse start offset")
var (
name = flag.String("name", "", "binlog file name")
offset = flag.Int64("offset", 0, "parse start offset")
)

func main() {
flag.Parse()
Expand Down
32 changes: 17 additions & 15 deletions cmd/go-canal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,28 @@ import (
"github.com/go-mysql-org/go-mysql/mysql"
)

var host = flag.String("host", "127.0.0.1", "MySQL host")
var port = flag.Int("port", 3306, "MySQL port")
var user = flag.String("user", "root", "MySQL user, must have replication privilege")
var password = flag.String("password", "", "MySQL password")
var (
host = flag.String("host", "127.0.0.1", "MySQL host")
port = flag.Int("port", 3306, "MySQL port")
user = flag.String("user", "root", "MySQL user, must have replication privilege")
password = flag.String("password", "", "MySQL password")

var flavor = flag.String("flavor", "mysql", "Flavor: mysql or mariadb")
flavor = flag.String("flavor", "mysql", "Flavor: mysql or mariadb")

var serverID = flag.Int("server-id", 101, "Unique Server ID")
var mysqldump = flag.String("mysqldump", "mysqldump", "mysqldump execution path")
serverID = flag.Int("server-id", 101, "Unique Server ID")
mysqldump = flag.String("mysqldump", "mysqldump", "mysqldump execution path")

var dbs = flag.String("dbs", "test", "dump databases, separated by comma")
var tables = flag.String("tables", "", "dump tables, separated by comma, will overwrite dbs")
var tableDB = flag.String("table_db", "test", "database for dump tables")
var ignoreTables = flag.String("ignore_tables", "", "ignore tables, must be database.table format, separated by comma")
dbs = flag.String("dbs", "test", "dump databases, separated by comma")
tables = flag.String("tables", "", "dump tables, separated by comma, will overwrite dbs")
tableDB = flag.String("table_db", "test", "database for dump tables")
ignoreTables = flag.String("ignore_tables", "", "ignore tables, must be database.table format, separated by comma")

var startName = flag.String("bin_name", "", "start sync from binlog name")
var startPos = flag.Uint("bin_pos", 0, "start sync from binlog position of")
startName = flag.String("bin_name", "", "start sync from binlog name")
startPos = flag.Uint("bin_pos", 0, "start sync from binlog position of")

var heartbeatPeriod = flag.Duration("heartbeat", 60*time.Second, "master heartbeat period")
var readTimeout = flag.Duration("read_timeout", 90*time.Second, "connection read timeout")
heartbeatPeriod = flag.Duration("heartbeat", 60*time.Second, "master heartbeat period")
readTimeout = flag.Duration("read_timeout", 90*time.Second, "connection read timeout")
)

func main() {
flag.Parse()
Expand Down
24 changes: 13 additions & 11 deletions cmd/go-mysqlbinlog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ import (
"github.com/go-mysql-org/go-mysql/replication"
)

var host = flag.String("host", "127.0.0.1", "MySQL host")
var port = flag.Int("port", 3306, "MySQL port")
var user = flag.String("user", "root", "MySQL user, must have replication privilege")
var password = flag.String("password", "", "MySQL password")
var (
host = flag.String("host", "127.0.0.1", "MySQL host")
port = flag.Int("port", 3306, "MySQL port")
user = flag.String("user", "root", "MySQL user, must have replication privilege")
password = flag.String("password", "", "MySQL password")

var flavor = flag.String("flavor", "mysql", "Flavor: mysql or mariadb")
flavor = flag.String("flavor", "mysql", "Flavor: mysql or mariadb")

var file = flag.String("file", "", "Binlog filename")
var pos = flag.Int("pos", 4, "Binlog position")
var gtid = flag.String("gtid", "", "Binlog GTID set that this slave has executed")
file = flag.String("file", "", "Binlog filename")
pos = flag.Int("pos", 4, "Binlog position")
gtid = flag.String("gtid", "", "Binlog GTID set that this slave has executed")

var semiSync = flag.Bool("semisync", false, "Support semi sync")
var backupPath = flag.String("backup_path", "", "backup path to store binlog files")
semiSync = flag.Bool("semisync", false, "Support semi sync")
backupPath = flag.String("backup_path", "", "backup path to store binlog files")

var rawMode = flag.Bool("raw", false, "Use raw mode")
rawMode = flag.Bool("raw", false, "Use raw mode")
)

func main() {
flag.Parse()
Expand Down
23 changes: 13 additions & 10 deletions cmd/go-mysqldump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ import (
"os"
"strings"

"github.com/go-mysql-org/go-mysql/dump"
"github.com/pingcap/errors"

"github.com/go-mysql-org/go-mysql/dump"
)

var addr = flag.String("addr", "127.0.0.1:3306", "MySQL addr")
var user = flag.String("user", "root", "MySQL user")
var password = flag.String("password", "", "MySQL password")
var execution = flag.String("exec", "mysqldump", "mysqldump execution path")
var output = flag.String("o", "", "dump output, empty for stdout")
var (
addr = flag.String("addr", "127.0.0.1:3306", "MySQL addr")
user = flag.String("user", "root", "MySQL user")
password = flag.String("password", "", "MySQL password")
execution = flag.String("exec", "mysqldump", "mysqldump execution path")
output = flag.String("o", "", "dump output, empty for stdout")

var dbs = flag.String("dbs", "", "dump databases, separated by comma")
var tables = flag.String("tables", "", "dump tables, separated by comma, will overwrite dbs")
var tableDB = flag.String("table_db", "", "database for dump tables")
var ignoreTables = flag.String("ignore_tables", "", "ignore tables, must be database.table format, separated by comma")
dbs = flag.String("dbs", "", "dump databases, separated by comma")
tables = flag.String("tables", "", "dump tables, separated by comma, will overwrite dbs")
tableDB = flag.String("table_db", "", "database for dump tables")
ignoreTables = flag.String("ignore_tables", "", "ignore tables, must be database.table format, separated by comma")
)

func main() {
flag.Parse()
Expand Down