func (d *initialDispatch) Handle(id uint64, r *msgp.Reader) (Dispatcher, error) { var err error switch id { case spool: var opts = make(Profile) var name string if err = checkSize(_onSpoolArgsNum, r); err != nil { return nil, err } if err = r.ReadMapStrIntf(opts); err != nil { return nil, err } if name, err = r.ReadString(); err != nil { return nil, err } return d.onSpool(opts, name) case spawn: var ( opts = make(Profile) name, executable string args = make(map[string]string) env = make(map[string]string) ) if err = checkSize(_onSpawnArgsNum, r); err != nil { return nil, err } if err = r.ReadMapStrIntf(opts); err != nil { return nil, err } if name, err = r.ReadString(); err != nil { return nil, err } if executable, err = r.ReadString(); err != nil { return nil, err } if err = readMapStrStr(r, args); err != nil { return nil, err } if err = readMapStrStr(r, env); err != nil { return nil, err } return d.onSpawn(opts, name, executable, args, env) default: return nil, fmt.Errorf("unknown transition id: %d", id) } }