update micro/cli to urfave/cli/v2 and fix go-micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
1d00f2f771
commit
e6a34bcbe7
@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/agent/input"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -36,21 +36,21 @@ type discordInput struct {
|
||||
|
||||
func (d *discordInput) Flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "discord_token",
|
||||
EnvVar: "MICRO_DISCORD_TOKEN",
|
||||
Usage: "Discord token (prefix with Bot if it's for bot account)",
|
||||
&cli.StringFlag{
|
||||
Name: "discord_token",
|
||||
EnvVars: []string{"MICRO_DISCORD_TOKEN"},
|
||||
Usage: "Discord token (prefix with Bot if it's for bot account)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "discord_whitelist",
|
||||
EnvVar: "MICRO_DISCORD_WHITELIST",
|
||||
Usage: "Discord Whitelist (seperated by ,)",
|
||||
&cli.StringFlag{
|
||||
Name: "discord_whitelist",
|
||||
EnvVars: []string{"MICRO_DISCORD_WHITELIST"},
|
||||
Usage: "Discord Whitelist (seperated by ,)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "discord_prefix",
|
||||
Usage: "Discord Prefix",
|
||||
EnvVar: "MICRO_DISCORD_PREFIX",
|
||||
Value: "Micro ",
|
||||
&cli.StringFlag{
|
||||
Name: "discord_prefix",
|
||||
Usage: "Discord Prefix",
|
||||
EnvVars: []string{"MICRO_DISCORD_PREFIX"},
|
||||
Value: "Micro ",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
package input
|
||||
|
||||
import (
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
type EventType string
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/agent/input"
|
||||
"github.com/nlopes/slack"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
type slackInput struct {
|
||||
@ -26,15 +26,15 @@ func init() {
|
||||
|
||||
func (p *slackInput) Flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "slack_debug",
|
||||
Usage: "Slack debug output",
|
||||
EnvVar: "MICRO_SLACK_DEBUG",
|
||||
&cli.BoolFlag{
|
||||
Name: "slack_debug",
|
||||
Usage: "Slack debug output",
|
||||
EnvVars: []string{"MICRO_SLACK_DEBUG"},
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "slack_token",
|
||||
Usage: "Slack token",
|
||||
EnvVar: "MICRO_SLACK_TOKEN",
|
||||
&cli.StringFlag{
|
||||
Name: "slack_token",
|
||||
Usage: "Slack token",
|
||||
EnvVars: []string{"MICRO_SLACK_TOKEN"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/agent/input"
|
||||
"github.com/micro/cli/v2"
|
||||
tgbotapi "gopkg.in/telegram-bot-api.v4"
|
||||
)
|
||||
|
||||
@ -34,20 +34,20 @@ func init() {
|
||||
|
||||
func (ti *telegramInput) Flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "telegram_debug",
|
||||
EnvVar: "MICRO_TELEGRAM_DEBUG",
|
||||
Usage: "Telegram debug output",
|
||||
&cli.BoolFlag{
|
||||
Name: "telegram_debug",
|
||||
EnvVars: []string{"MICRO_TELEGRAM_DEBUG"},
|
||||
Usage: "Telegram debug output",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "telegram_token",
|
||||
EnvVar: "MICRO_TELEGRAM_TOKEN",
|
||||
Usage: "Telegram token",
|
||||
&cli.StringFlag{
|
||||
Name: "telegram_token",
|
||||
EnvVars: []string{"MICRO_TELEGRAM_TOKEN"},
|
||||
Usage: "Telegram token",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "telegram_whitelist",
|
||||
EnvVar: "MICRO_TELEGRAM_WHITELIST",
|
||||
Usage: "Telegram bot's users (comma-separated values)",
|
||||
&cli.StringFlag{
|
||||
Name: "telegram_whitelist",
|
||||
EnvVars: []string{"MICRO_TELEGRAM_WHITELIST"},
|
||||
Usage: "Telegram bot's users (comma-separated values)",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/broker"
|
||||
"github.com/micro/go-micro/client"
|
||||
"github.com/micro/go-micro/client/selector"
|
||||
@ -25,6 +24,7 @@ import (
|
||||
// servers
|
||||
sgrpc "github.com/micro/go-micro/server/grpc"
|
||||
smucp "github.com/micro/go-micro/server/mucp"
|
||||
"github.com/micro/cli/v2"
|
||||
|
||||
// brokers
|
||||
"github.com/micro/go-micro/broker/memory"
|
||||
@ -73,140 +73,140 @@ var (
|
||||
DefaultCmd = newCmd()
|
||||
|
||||
DefaultFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "client",
|
||||
EnvVar: "MICRO_CLIENT",
|
||||
Usage: "Client for go-micro; rpc",
|
||||
&cli.StringFlag{
|
||||
Name: "client",
|
||||
EnvVars: []string{"MICRO_CLIENT"},
|
||||
Usage: "Client for go-micro; rpc",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "client_request_timeout",
|
||||
EnvVar: "MICRO_CLIENT_REQUEST_TIMEOUT",
|
||||
Usage: "Sets the client request timeout. e.g 500ms, 5s, 1m. Default: 5s",
|
||||
&cli.StringFlag{
|
||||
Name: "client_request_timeout",
|
||||
EnvVars: []string{"MICRO_CLIENT_REQUEST_TIMEOUT"},
|
||||
Usage: "Sets the client request timeout. e.g 500ms, 5s, 1m. Default: 5s",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "client_retries",
|
||||
EnvVar: "MICRO_CLIENT_RETRIES",
|
||||
Value: client.DefaultRetries,
|
||||
Usage: "Sets the client retries. Default: 1",
|
||||
&cli.IntFlag{
|
||||
Name: "client_retries",
|
||||
EnvVars: []string{"MICRO_CLIENT_RETRIES"},
|
||||
Value: client.DefaultRetries,
|
||||
Usage: "Sets the client retries. Default: 1",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "client_pool_size",
|
||||
EnvVar: "MICRO_CLIENT_POOL_SIZE",
|
||||
Usage: "Sets the client connection pool size. Default: 1",
|
||||
&cli.IntFlag{
|
||||
Name: "client_pool_size",
|
||||
EnvVars: []string{"MICRO_CLIENT_POOL_SIZE"},
|
||||
Usage: "Sets the client connection pool size. Default: 1",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "client_pool_ttl",
|
||||
EnvVar: "MICRO_CLIENT_POOL_TTL",
|
||||
Usage: "Sets the client connection pool ttl. e.g 500ms, 5s, 1m. Default: 1m",
|
||||
&cli.StringFlag{
|
||||
Name: "client_pool_ttl",
|
||||
EnvVars: []string{"MICRO_CLIENT_POOL_TTL"},
|
||||
Usage: "Sets the client connection pool ttl. e.g 500ms, 5s, 1m. Default: 1m",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "register_ttl",
|
||||
EnvVar: "MICRO_REGISTER_TTL",
|
||||
Value: 60,
|
||||
Usage: "Register TTL in seconds",
|
||||
&cli.IntFlag{
|
||||
Name: "register_ttl",
|
||||
EnvVars: []string{"MICRO_REGISTER_TTL"},
|
||||
Value: 60,
|
||||
Usage: "Register TTL in seconds",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "register_interval",
|
||||
EnvVar: "MICRO_REGISTER_INTERVAL",
|
||||
Value: 30,
|
||||
Usage: "Register interval in seconds",
|
||||
&cli.IntFlag{
|
||||
Name: "register_interval",
|
||||
EnvVars: []string{"MICRO_REGISTER_INTERVAL"},
|
||||
Value: 30,
|
||||
Usage: "Register interval in seconds",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "server",
|
||||
EnvVar: "MICRO_SERVER",
|
||||
Usage: "Server for go-micro; rpc",
|
||||
&cli.StringFlag{
|
||||
Name: "server",
|
||||
EnvVars: []string{"MICRO_SERVER"},
|
||||
Usage: "Server for go-micro; rpc",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "server_name",
|
||||
EnvVar: "MICRO_SERVER_NAME",
|
||||
Usage: "Name of the server. go.micro.srv.example",
|
||||
&cli.StringFlag{
|
||||
Name: "server_name",
|
||||
EnvVars: []string{"MICRO_SERVER_NAME"},
|
||||
Usage: "Name of the server. go.micro.srv.example",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "server_version",
|
||||
EnvVar: "MICRO_SERVER_VERSION",
|
||||
Usage: "Version of the server. 1.1.0",
|
||||
&cli.StringFlag{
|
||||
Name: "server_version",
|
||||
EnvVars: []string{"MICRO_SERVER_VERSION"},
|
||||
Usage: "Version of the server. 1.1.0",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "server_id",
|
||||
EnvVar: "MICRO_SERVER_ID",
|
||||
Usage: "Id of the server. Auto-generated if not specified",
|
||||
&cli.StringFlag{
|
||||
Name: "server_id",
|
||||
EnvVars: []string{"MICRO_SERVER_ID"},
|
||||
Usage: "Id of the server. Auto-generated if not specified",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "server_address",
|
||||
EnvVar: "MICRO_SERVER_ADDRESS",
|
||||
Usage: "Bind address for the server. 127.0.0.1:8080",
|
||||
&cli.StringFlag{
|
||||
Name: "server_address",
|
||||
EnvVars: []string{"MICRO_SERVER_ADDRESS"},
|
||||
Usage: "Bind address for the server. 127.0.0.1:8080",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "server_advertise",
|
||||
EnvVar: "MICRO_SERVER_ADVERTISE",
|
||||
Usage: "Used instead of the server_address when registering with discovery. 127.0.0.1:8080",
|
||||
&cli.StringFlag{
|
||||
Name: "server_advertise",
|
||||
EnvVars: []string{"MICRO_SERVER_ADVERTISE"},
|
||||
Usage: "Used instead of the server_address when registering with discovery. 127.0.0.1:8080",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "server_metadata",
|
||||
EnvVar: "MICRO_SERVER_METADATA",
|
||||
Value: &cli.StringSlice{},
|
||||
Usage: "A list of key-value pairs defining metadata. version=1.0.0",
|
||||
&cli.StringSliceFlag{
|
||||
Name: "server_metadata",
|
||||
EnvVars: []string{"MICRO_SERVER_METADATA"},
|
||||
Value: &cli.StringSlice{},
|
||||
Usage: "A list of key-value pairs defining metadata. version=1.0.0",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "broker",
|
||||
EnvVar: "MICRO_BROKER",
|
||||
Usage: "Broker for pub/sub. http, nats, rabbitmq",
|
||||
&cli.StringFlag{
|
||||
Name: "broker",
|
||||
EnvVars: []string{"MICRO_BROKER"},
|
||||
Usage: "Broker for pub/sub. http, nats, rabbitmq",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "broker_address",
|
||||
EnvVar: "MICRO_BROKER_ADDRESS",
|
||||
Usage: "Comma-separated list of broker addresses",
|
||||
&cli.StringFlag{
|
||||
Name: "broker_address",
|
||||
EnvVars: []string{"MICRO_BROKER_ADDRESS"},
|
||||
Usage: "Comma-separated list of broker addresses",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "profile",
|
||||
Usage: "Debug profiler for cpu and memory stats",
|
||||
EnvVar: "MICRO_DEBUG_PROFILE",
|
||||
&cli.StringFlag{
|
||||
Name: "profile",
|
||||
Usage: "Debug profiler for cpu and memory stats",
|
||||
EnvVars: []string{"MICRO_DEBUG_PROFILE"},
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "registry",
|
||||
EnvVar: "MICRO_REGISTRY",
|
||||
Usage: "Registry for discovery. etcd, mdns",
|
||||
&cli.StringFlag{
|
||||
Name: "registry",
|
||||
EnvVars: []string{"MICRO_REGISTRY"},
|
||||
Usage: "Registry for discovery. etcd, mdns",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "registry_address",
|
||||
EnvVar: "MICRO_REGISTRY_ADDRESS",
|
||||
Usage: "Comma-separated list of registry addresses",
|
||||
&cli.StringFlag{
|
||||
Name: "registry_address",
|
||||
EnvVars: []string{"MICRO_REGISTRY_ADDRESS"},
|
||||
Usage: "Comma-separated list of registry addresses",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "runtime",
|
||||
Usage: "Runtime for building and running services e.g local, kubernetes",
|
||||
EnvVar: "MICRO_RUNTIME",
|
||||
Value: "local",
|
||||
&cli.StringFlag{
|
||||
Name: "runtime",
|
||||
Usage: "Runtime for building and running services e.g local, kubernetes",
|
||||
EnvVars: []string{"MICRO_RUNTIME"},
|
||||
Value: "local",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "selector",
|
||||
EnvVar: "MICRO_SELECTOR",
|
||||
Usage: "Selector used to pick nodes for querying",
|
||||
&cli.StringFlag{
|
||||
Name: "selector",
|
||||
EnvVars: []string{"MICRO_SELECTOR"},
|
||||
Usage: "Selector used to pick nodes for querying",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "store",
|
||||
EnvVar: "MICRO_STORE",
|
||||
Usage: "Store used for key-value storage",
|
||||
&cli.StringFlag{
|
||||
Name: "store",
|
||||
EnvVars: []string{"MICRO_STORE"},
|
||||
Usage: "Store used for key-value storage",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "store_address",
|
||||
EnvVar: "MICRO_STORE_ADDRESS",
|
||||
Usage: "Comma-separated list of store addresses",
|
||||
&cli.StringFlag{
|
||||
Name: "store_address",
|
||||
EnvVars: []string{"MICRO_STORE_ADDRESS"},
|
||||
Usage: "Comma-separated list of store addresses",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "store_namespace",
|
||||
EnvVar: "MICRO_STORE_NAMESPACE",
|
||||
Usage: "Namespace for store data",
|
||||
&cli.StringFlag{
|
||||
Name: "store_namespace",
|
||||
EnvVars: []string{"MICRO_STORE_NAMESPACE"},
|
||||
Usage: "Namespace for store data",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "transport",
|
||||
EnvVar: "MICRO_TRANSPORT",
|
||||
Usage: "Transport mechanism used; http",
|
||||
&cli.StringFlag{
|
||||
Name: "transport",
|
||||
EnvVars: []string{"MICRO_TRANSPORT"},
|
||||
Usage: "Transport mechanism used; http",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "transport_address",
|
||||
EnvVar: "MICRO_TRANSPORT_ADDRESS",
|
||||
Usage: "Comma-separated list of transport addresses",
|
||||
&cli.StringFlag{
|
||||
Name: "transport_address",
|
||||
EnvVars: []string{"MICRO_TRANSPORT_ADDRESS"},
|
||||
Usage: "Comma-separated list of transport addresses",
|
||||
},
|
||||
}
|
||||
|
||||
@ -306,7 +306,9 @@ func newCmd(opts ...Option) Cmd {
|
||||
cmd.app.Usage = cmd.opts.Description
|
||||
cmd.app.Before = cmd.Before
|
||||
cmd.app.Flags = DefaultFlags
|
||||
cmd.app.Action = func(c *cli.Context) {}
|
||||
cmd.app.Action = func(c *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(options.Version) == 0 {
|
||||
cmd.app.HideVersion = true
|
||||
@ -489,11 +491,11 @@ func (c *cmd) Before(ctx *cli.Context) error {
|
||||
serverOpts = append(serverOpts, server.Advertise(ctx.String("server_advertise")))
|
||||
}
|
||||
|
||||
if ttl := time.Duration(ctx.GlobalInt("register_ttl")); ttl >= 0 {
|
||||
if ttl := time.Duration(ctx.Int("register_ttl")); ttl >= 0 {
|
||||
serverOpts = append(serverOpts, server.RegisterTTL(ttl*time.Second))
|
||||
}
|
||||
|
||||
if val := time.Duration(ctx.GlobalInt("register_interval")); val >= 0 {
|
||||
if val := time.Duration(ctx.Int("register_interval")); val >= 0 {
|
||||
serverOpts = append(serverOpts, server.RegisterInterval(val*time.Second))
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/config/cmd"
|
||||
"github.com/micro/go-micro/config/source"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
type cliSource struct {
|
||||
@ -21,11 +21,6 @@ type cliSource struct {
|
||||
func (c *cliSource) Read() (*source.ChangeSet, error) {
|
||||
var changes map[string]interface{}
|
||||
|
||||
for _, name := range c.ctx.GlobalFlagNames() {
|
||||
tmp := toEntry(name, c.ctx.GlobalGeneric(name))
|
||||
mergo.Map(&changes, tmp) // need to sort error handling
|
||||
}
|
||||
|
||||
for _, name := range c.ctx.FlagNames() {
|
||||
tmp := toEntry(name, c.ctx.Generic(name))
|
||||
mergo.Map(&changes, tmp) // need to sort error handling
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/config/cmd"
|
||||
"github.com/micro/go-micro/config/source"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
func test(t *testing.T, withContext bool) {
|
||||
@ -17,14 +17,15 @@ func test(t *testing.T, withContext bool) {
|
||||
app := cmd.App()
|
||||
app.Name = "testapp"
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{Name: "db-host"},
|
||||
&cli.StringFlag{Name: "db-host"},
|
||||
}
|
||||
|
||||
// with context
|
||||
if withContext {
|
||||
// set action
|
||||
app.Action = func(c *cli.Context) {
|
||||
app.Action = func(c *cli.Context) error {
|
||||
src = WithContext(c)
|
||||
return nil
|
||||
}
|
||||
|
||||
// run app
|
||||
|
@ -3,7 +3,7 @@ package cli
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/micro/go-micro/config/source"
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"flag"
|
||||
"strings"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
func copyFlag(name string, ff *flag.Flag, set *flag.FlagSet) {
|
||||
@ -22,7 +22,7 @@ func normalizeFlags(flags []cli.Flag, set *flag.FlagSet) error {
|
||||
visited[f.Name] = true
|
||||
})
|
||||
for _, f := range flags {
|
||||
parts := strings.Split(f.GetName(), ",")
|
||||
parts := f.Names()
|
||||
if len(parts) == 1 {
|
||||
continue
|
||||
}
|
||||
|
6
go.mod
6
go.mod
@ -19,7 +19,7 @@ require (
|
||||
github.com/go-acme/lego/v3 v3.3.0
|
||||
github.com/go-playground/universal-translator v0.17.0 // indirect
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
||||
github.com/golang/protobuf v1.3.2
|
||||
github.com/google/uuid v1.1.1
|
||||
github.com/gorilla/handlers v1.4.2
|
||||
@ -36,7 +36,7 @@ require (
|
||||
github.com/lib/pq v1.3.0
|
||||
github.com/lucas-clemente/quic-go v0.14.1
|
||||
github.com/mholt/certmagic v0.9.1
|
||||
github.com/micro/cli v0.2.0
|
||||
github.com/micro/cli/v2 v2.1.1
|
||||
github.com/micro/mdns v0.3.0
|
||||
github.com/miekg/dns v1.1.27
|
||||
github.com/mitchellh/hashstructure v1.0.0
|
||||
@ -48,7 +48,7 @@ require (
|
||||
github.com/soheilhy/cmux v0.1.4 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc // indirect
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
|
||||
go.etcd.io/bbolt v1.3.3 // indirect
|
||||
go.uber.org/zap v1.13.0
|
||||
|
19
go.sum
19
go.sum
@ -97,6 +97,7 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -161,9 +162,10 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
|
||||
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 h1:5ZkaAPbicIKTF2I64qf5Fh8Aa83Q/dnOafMYV0OMwjA=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
@ -173,6 +175,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
@ -276,8 +279,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mholt/certmagic v0.9.1 h1:wPzyouOyE+30NIQETJuhTB5ZQWz+0Hy038vaR5WWQDE=
|
||||
github.com/mholt/certmagic v0.9.1/go.mod h1:nu8jbsbtwK4205EDH/ZUMTKsfYpJA1Q7MKXHfgTihNw=
|
||||
github.com/micro/cli v0.2.0 h1:ut3rV5JWqZjsXIa2MvGF+qMUP8DAUTvHX9Br5gO4afA=
|
||||
github.com/micro/cli v0.2.0/go.mod h1:jRT9gmfVKWSS6pkKcXQ8YhUyj6bzwxK8Fp5b0Y7qNnk=
|
||||
github.com/micro/cli/v2 v2.1.1 h1:uFw0SMIKmGuyHIm8lXns/NOn7V62bM5y7DnlxUM+BEQ=
|
||||
github.com/micro/cli/v2 v2.1.1/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg=
|
||||
github.com/micro/mdns v0.3.0 h1:bYycYe+98AXR3s8Nq5qvt6C573uFTDPIYzJemWON0QE=
|
||||
github.com/micro/mdns v0.3.0/go.mod h1:KJ0dW7KmicXU2BV++qkLlmHYcVv7/hHnbtguSWt9Aoc=
|
||||
github.com/miekg/dns v1.1.3/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
@ -373,11 +376,13 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
@ -401,8 +406,8 @@ github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG
|
||||
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
|
||||
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
|
||||
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7/go.mod h1:imsgLplxEC/etjIhdr3dNzV3JeT27LbVu5pYWm0JCBY=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc h1:yUaosFVTJwnltaHbSNC3i82I92quFs+OFPRl8kNMVwo=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY=
|
||||
github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g=
|
||||
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
@ -464,6 +469,7 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
@ -559,6 +565,7 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/broker"
|
||||
"github.com/micro/go-micro/client"
|
||||
"github.com/micro/go-micro/client/selector"
|
||||
@ -12,6 +11,7 @@ import (
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/server"
|
||||
"github.com/micro/go-micro/transport"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
@ -166,7 +166,7 @@ func Flags(flags ...cli.Flag) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func Action(a func(*cli.Context)) Option {
|
||||
func Action(a func(*cli.Context) error) Option {
|
||||
return func(o *Options) {
|
||||
o.Cmd.App().Action = a
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/micro/go-micro"
|
||||
"github.com/micro/go-micro/registry"
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro"
|
||||
"github.com/micro/go-micro/registry"
|
||||
maddr "github.com/micro/go-micro/util/addr"
|
||||
@ -22,6 +21,7 @@ import (
|
||||
"github.com/micro/go-micro/util/log"
|
||||
mnet "github.com/micro/go-micro/util/net"
|
||||
mls "github.com/micro/go-micro/util/tls"
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
type service struct {
|
||||
@ -327,7 +327,7 @@ func (s *service) Init(opts ...Option) error {
|
||||
serviceOpts = append(serviceOpts, micro.Registry(s.opts.Registry))
|
||||
}
|
||||
|
||||
serviceOpts = append(serviceOpts, micro.Action(func(ctx *cli.Context) {
|
||||
serviceOpts = append(serviceOpts, micro.Action(func(ctx *cli.Context) error {
|
||||
if ttl := ctx.Int("register_ttl"); ttl > 0 {
|
||||
s.opts.RegisterTTL = time.Duration(ttl) * time.Second
|
||||
}
|
||||
@ -359,6 +359,8 @@ func (s *service) Init(opts ...Option) error {
|
||||
if s.opts.Action != nil {
|
||||
s.opts.Action(ctx)
|
||||
}
|
||||
|
||||
return nil
|
||||
}))
|
||||
|
||||
s.opts.Service.Init(serviceOpts...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user