Merge pull request #71 from unistack-org/tweaks

NewConfig returns native type
This commit is contained in:
Василий Толстов 2022-03-13 11:45:44 +03:00 committed by GitHub
commit 69a9a31f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,8 @@ import (
rutil "go.unistack.org/micro/v3/util/reflect" rutil "go.unistack.org/micro/v3/util/reflect"
) )
var _ config.Config = &serviceConfig{}
var DefaultStructTag = "service" var DefaultStructTag = "service"
type serviceConfig struct { type serviceConfig struct {
@ -142,7 +144,7 @@ func (c *serviceConfig) Watch(ctx context.Context, opts ...config.WatchOption) (
return nil, fmt.Errorf("not implemented") return nil, fmt.Errorf("not implemented")
} }
func NewConfig(opts ...config.Option) config.Config { func NewConfig(opts ...config.Option) *serviceConfig {
options := config.NewOptions(opts...) options := config.NewOptions(opts...)
if len(options.StructTag) == 0 { if len(options.StructTag) == 0 {
options.StructTag = DefaultStructTag options.StructTag = DefaultStructTag