vitess icon indicating copy to clipboard operation
vitess copied to clipboard

Switch flag definitions to be on pflag instead of flag in `package go/cmd/topo2topo`

Open ajm188 opened this issue 2 years ago • 1 comments

Part of https://github.com/vitessio/vitess/issues/10697.

Current flags:

$ git grep -E "\bflag\.[A-Z]" -- go/cmd/topo2topo/*.go
go/cmd/topo2topo/topo2topo.go:  fromImplementation = flag.String("from_implementation", "", "topology implementation to copy data from")
go/cmd/topo2topo/topo2topo.go:  fromServerAddress  = flag.String("from_server", "", "topology server address to copy data from")
go/cmd/topo2topo/topo2topo.go:  fromRoot           = flag.String("from_root", "", "topology server root to copy data from")
go/cmd/topo2topo/topo2topo.go:  toImplementation = flag.String("to_implementation", "", "topology implementation to copy data to")
go/cmd/topo2topo/topo2topo.go:  toServerAddress  = flag.String("to_server", "", "topology server address to copy data to")
go/cmd/topo2topo/topo2topo.go:  toRoot           = flag.String("to_root", "", "topology server root to copy data to")
go/cmd/topo2topo/topo2topo.go:  compare             = flag.Bool("compare", false, "compares data between topologies")
go/cmd/topo2topo/topo2topo.go:  doKeyspaces         = flag.Bool("do-keyspaces", false, "copies the keyspace information")
go/cmd/topo2topo/topo2topo.go:  doShards            = flag.Bool("do-shards", false, "copies the shard information")
go/cmd/topo2topo/topo2topo.go:  doShardReplications = flag.Bool("do-shard-replications", false, "copies the shard replication information")
go/cmd/topo2topo/topo2topo.go:  doTablets           = flag.Bool("do-tablets", false, "copies the tablet information")
go/cmd/topo2topo/topo2topo.go:  doRoutingRules      = flag.Bool("do-routing-rules", false, "copies the routing rules")
go/cmd/topo2topo/topo2topo.go:          flag.Usage()

ajm188 avatar Sep 21 '22 10:09 ajm188

go list -f '{{ .ImportPath }}| {{ join .Deps " " }} ' ./go/cmd/... | awk -F"|" '$2 ~ "vitess.io/vitess/go/cmd" {print $1}' vitess.io/vitess/go/cmd/mysqlctl vitess.io/vitess/go/cmd/rulesctl vitess.io/vitess/go/cmd/rulesctl/cmd vitess.io/vitess/go/cmd/vtbackup vitess.io/vitess/go/cmd/vtcombo vitess.io/vitess/go/cmd/vtctl vitess.io/vitess/go/cmd/vtctld vitess.io/vitess/go/cmd/vtctldclient vitess.io/vitess/go/cmd/vtctldclient/command vitess.io/vitess/go/cmd/vtctldclient/docgen vitess.io/vitess/go/cmd/vtgateclienttest vitess.io/vitess/go/cmd/zk

rsajwani avatar Sep 22 '22 18:09 rsajwani

It is a standalone tool, no other binary should be using it.

harshit-gangal avatar Sep 23 '22 12:09 harshit-gangal

@rsajwani that go list doesn't make sense to me .. you're listing go/cmd and then seeing of that set if there are any packages in go/cmd, which is always going to be an exact set equivalence; you've basically done a bijection with go list

ajm188 avatar Sep 23 '22 13:09 ajm188