diff --git a/contrib/config/consul/config.go b/contrib/config/consul/config.go index 8025ec967..afdf91323 100644 --- a/contrib/config/consul/config.go +++ b/contrib/config/consul/config.go @@ -18,7 +18,7 @@ type options struct { path string } -// WithContext with registry context. +// WithContext with registry context. func WithContext(ctx context.Context) Option { return Option(func(o *options) { o.ctx = ctx @@ -71,6 +71,9 @@ func (s *source) Load() ([]*config.KeyValue, error) { kvs := make([]*config.KeyValue, 0) for _, item := range kv { k := strings.TrimPrefix(item.Key, pathPrefix) + if k == "" { + continue + } kvs = append(kvs, &config.KeyValue{ Key: k, Value: item.Value,