1
0
Fork 0

Keep actor private

Also this:
core/units.go:21: impl.Impl.Call is a field, not a method
This commit is contained in:
Gregory Eremin 2015-02-11 01:45:13 +07:00
parent 26224fd975
commit 8748c22d6e
3 changed files with 11 additions and 7 deletions

View File

@ -4,7 +4,7 @@ package impl
// Comes handy when you need to mock a unit
func Echo() *Impl {
return &Impl{
Call: func(data []byte) (resp []byte, err error) {
actor: func(data []byte) (resp []byte, err error) {
return data, nil
},
}

View File

@ -2,14 +2,10 @@ package impl
type (
Impl struct {
Call func([]byte) ([]byte, error)
actor func([]byte) ([]byte, error)
}
)
func (i *Impl) Units() []string {
return []string{}
}
func New(name string) *Impl {
switch name {
case "units.throttler.Throttler":
@ -18,3 +14,11 @@ func New(name string) *Impl {
return nil
}
}
func (i *Impl) Call(data []byte) (resp []byte, err error) {
return i.actor(data)
}
func (i *Impl) Units() []string {
return []string{}
}

View File

@ -2,7 +2,7 @@ package impl
func Throttler() *Impl {
return &Impl{
Call: func(data []byte) (resp []byte, err error) {
actor: func(data []byte) (resp []byte, err error) {
return data, nil
},
}