From ca3b8224f63fdfba194a1002f7f590c99e0cfbd4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 20 Feb 2018 17:39:16 -0800 Subject: [PATCH] remove some dead code (it was causing go vet to complain) License: MIT Signed-off-by: Steven Allen --- commands/legacy/request.go | 5 ----- commands/request.go | 33 --------------------------------- 2 files changed, 38 deletions(-) diff --git a/commands/legacy/request.go b/commands/legacy/request.go index e0c65405c..cd353d9b7 100644 --- a/commands/legacy/request.go +++ b/commands/legacy/request.go @@ -135,11 +135,6 @@ func (r *requestWrapper) SetOptions(om cmdkit.OptMap) error { return convertOptions(r.req) } -func (r *requestWrapper) SetRootContext(ctx context.Context) error { - r.req.Context = ctx - return nil -} - func (r *requestWrapper) Stdin() io.Reader { return os.Stdin } diff --git a/commands/request.go b/commands/request.go index 361fdbe7f..4711024ad 100644 --- a/commands/request.go +++ b/commands/request.go @@ -120,7 +120,6 @@ type Request interface { Files() files.File SetFiles(files.File) Context() context.Context - SetRootContext(context.Context) error InvocContext() *Context SetInvocContext(Context) Command() *Command @@ -185,16 +184,6 @@ func (r *request) Options() cmdkit.OptMap { return output } -func (r *request) SetRootContext(ctx context.Context) error { - ctx, err := getContext(ctx, r) - if err != nil { - return err - } - - r.rctx = ctx - return nil -} - // SetOption sets the value of the option for given name. func (r *request) SetOption(name string, val interface{}) { // find the option with the specified name @@ -308,28 +297,6 @@ func (r *request) VarArgs(f func(string) error) error { return nil } -func getContext(base context.Context, req Request) (context.Context, error) { - tout, found, err := req.Option("timeout").String() - if err != nil { - return nil, fmt.Errorf("error parsing timeout option: %s", err) - } - - var ctx context.Context - if found { - duration, err := time.ParseDuration(tout) - if err != nil { - return nil, fmt.Errorf("error parsing timeout option: %s", err) - } - - tctx, _ := context.WithTimeout(base, duration) - ctx = tctx - } else { - cctx, _ := context.WithCancel(base) - ctx = cctx - } - return ctx, nil -} - func (r *request) InvocContext() *Context { return &r.ctx }