remove some dead code
(it was causing go vet to complain) License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Feb 20, 2018 at 17:39 UTC
ca3b8224f63fdfba194a1002f7f590c99e0cfbd4
2 files changed
-38
commands/legacy/request.go
-5
@@ -135,11 +135,6 @@ func (r *requestWrapper) SetOptions(om cmdkit.OptMap) error {
135
return convertOptions(r.req)
136
}
137
138
-func (r *requestWrapper) SetRootContext(ctx context.Context) error {
139
- r.req.Context = ctx
140
- return nil
141
-}
142
-
138
func (r *requestWrapper) Stdin() io.Reader {
139
return os.Stdin
140
}
commands/request.go
-33
@@ -120,7 +120,6 @@ type Request interface {
120
Files() files.File
121
SetFiles(files.File)
122
Context() context.Context
123
- SetRootContext(context.Context) error
123
InvocContext() *Context
124
SetInvocContext(Context)
125
Command() *Command
@@ -185,16 +184,6 @@ func (r *request) Options() cmdkit.OptMap {
184
return output
185
}
186
188
-func (r *request) SetRootContext(ctx context.Context) error {
189
- ctx, err := getContext(ctx, r)
190
- if err != nil {
191
- return err
192
- }
193
-
194
- r.rctx = ctx
195
- return nil
196
-}
197
-
187
// SetOption sets the value of the option for given name.
188
func (r *request) SetOption(name string, val interface{}) {
189
// find the option with the specified name
@@ -308,28 +297,6 @@ func (r *request) VarArgs(f func(string) error) error {
297
return nil
298
}
299
311
-func getContext(base context.Context, req Request) (context.Context, error) {
312
- tout, found, err := req.Option("timeout").String()
313
- if err != nil {
314
- return nil, fmt.Errorf("error parsing timeout option: %s", err)
315
- }
316
-
317
- var ctx context.Context
318
- if found {
319
- duration, err := time.ParseDuration(tout)
320
- if err != nil {
321
- return nil, fmt.Errorf("error parsing timeout option: %s", err)
322
- }
323
-
324
- tctx, _ := context.WithTimeout(base, duration)
325
- ctx = tctx
326
- } else {
327
- cctx, _ := context.WithCancel(base)
328
- ctx = cctx
329
- }
330
- return ctx, nil
331
-}
332
-
300
func (r *request) InvocContext() *Context {
301
return &r.ctx
302
}