From 8a2e84d489c570f94b6caa29af3641be615e310b Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 24 Nov 2021 00:57:59 +0300 Subject: [PATCH] minor changes Signed-off-by: Vasiliy Tolstov --- server/options.go | 3 ++- server/server.go | 3 --- util/reflect/reflect.go | 5 ++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/options.go b/server/options.go index 3b7ec988..ea0d78be 100644 --- a/server/options.go +++ b/server/options.go @@ -16,6 +16,7 @@ import ( "go.unistack.org/micro/v3/network/transport" "go.unistack.org/micro/v3/register" "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v3/util/id" ) // Option func @@ -106,7 +107,7 @@ func NewOptions(opts ...Option) Options { Address: DefaultAddress, Name: DefaultName, Version: DefaultVersion, - ID: DefaultID, + ID: id.Must(), Namespace: DefaultNamespace, } diff --git a/server/server.go b/server/server.go index 45b63f5f..9217b1e6 100644 --- a/server/server.go +++ b/server/server.go @@ -8,7 +8,6 @@ import ( "go.unistack.org/micro/v3/codec" "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/util/id" ) // DefaultServer default server @@ -21,8 +20,6 @@ var ( DefaultName = "server" // DefaultVersion will be used if no version passed DefaultVersion = "latest" - // DefaultID will be used if no id passed - DefaultID = id.Must() // DefaultRegisterCheck holds func that run before register server DefaultRegisterCheck = func(context.Context) error { return nil } // DefaultRegisterInterval holds interval for register diff --git a/util/reflect/reflect.go b/util/reflect/reflect.go index 9ac53d47..b9e82077 100644 --- a/util/reflect/reflect.go +++ b/util/reflect/reflect.go @@ -91,7 +91,10 @@ func Merge(dst interface{}, mp map[string]interface{}, opts ...Option) error { val, ok := mp[fname] if !ok { - continue + val, ok = mp[dfld.Name] + if !ok { + continue + } } sval = reflect.ValueOf(val)