Add default values

This commit is contained in:
Ferran Borreguero 2021-10-25 14:14:58 +02:00
parent a22a68cdc2
commit 765a4b93d7
2 changed files with 8 additions and 9 deletions

View file

@ -41,9 +41,10 @@ func (d *DebugCommand) Flags() *flagset.Flagset {
flags := d.NewFlagSet("debug")
flags.Uint64Flag(&flagset.Uint64Flag{
Name: "seconds",
Usage: "seconds to trace",
Value: &d.seconds,
Name: "seconds",
Usage: "seconds to trace",
Value: &d.seconds,
Default: 5,
})
flags.StringFlag(&flagset.StringFlag{
Name: "output",

View file

@ -97,17 +97,15 @@ func (m *Meta2) NewFlagSet(n string) *flagset.Flagset {
f := flagset.NewFlagSet(n)
f.StringFlag(&flagset.StringFlag{
Name: "address",
Value: &m.addr,
Usage: "Address of the grpc endpoint",
Name: "address",
Value: &m.addr,
Usage: "Address of the grpc endpoint",
Default: "127.0.0.1:3131",
})
return f
}
func (m *Meta2) Conn() (*grpc.ClientConn, error) {
if m.addr == "" {
m.addr = "127.0.0.1:3131"
}
conn, err := grpc.Dial(m.addr, grpc.WithInsecure())
if err != nil {
return nil, fmt.Errorf("failed to connect to server: %v", err)