minor fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
eb107020c7
commit
c592fabe2a
@ -32,7 +32,7 @@ func TestMemoryBroker(t *testing.T) {
|
||||
"foo": "bar",
|
||||
"id": fmt.Sprintf("%d", i),
|
||||
},
|
||||
Body: []byte(`hello world`),
|
||||
Body: []byte(`"hello world"`),
|
||||
}
|
||||
|
||||
if err := b.Publish(ctx, topic, message); err != nil {
|
||||
|
@ -43,13 +43,13 @@ type Watcher interface {
|
||||
}
|
||||
|
||||
// Load loads config from config sources
|
||||
func Load(ctx context.Context, cs ...Config) error {
|
||||
func Load(ctx context.Context, cs []Config, opts ...LoadOption) error {
|
||||
var err error
|
||||
for _, c := range cs {
|
||||
if err = c.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = c.Load(ctx); err != nil {
|
||||
if err = c.Load(ctx, opts...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
15
util/fn/fn.go
Normal file
15
util/fn/fn.go
Normal file
@ -0,0 +1,15 @@
|
||||
package fn
|
||||
|
||||
type Initer interface {
|
||||
Init(opts ...interface{}) error
|
||||
}
|
||||
|
||||
func Init(ifaces ...Initer) error {
|
||||
var err error
|
||||
for _, iface := range ifaces {
|
||||
if err = iface.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user