mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 00:39:31 +08:00
remove some dead code
(it was causing go vet to complain) License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
@ -135,11 +135,6 @@ func (r *requestWrapper) SetOptions(om cmdkit.OptMap) error {
|
|||||||
return convertOptions(r.req)
|
return convertOptions(r.req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *requestWrapper) SetRootContext(ctx context.Context) error {
|
|
||||||
r.req.Context = ctx
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *requestWrapper) Stdin() io.Reader {
|
func (r *requestWrapper) Stdin() io.Reader {
|
||||||
return os.Stdin
|
return os.Stdin
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,6 @@ type Request interface {
|
|||||||
Files() files.File
|
Files() files.File
|
||||||
SetFiles(files.File)
|
SetFiles(files.File)
|
||||||
Context() context.Context
|
Context() context.Context
|
||||||
SetRootContext(context.Context) error
|
|
||||||
InvocContext() *Context
|
InvocContext() *Context
|
||||||
SetInvocContext(Context)
|
SetInvocContext(Context)
|
||||||
Command() *Command
|
Command() *Command
|
||||||
@ -185,16 +184,6 @@ func (r *request) Options() cmdkit.OptMap {
|
|||||||
return output
|
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.
|
// SetOption sets the value of the option for given name.
|
||||||
func (r *request) SetOption(name string, val interface{}) {
|
func (r *request) SetOption(name string, val interface{}) {
|
||||||
// find the option with the specified name
|
// find the option with the specified name
|
||||||
@ -308,28 +297,6 @@ func (r *request) VarArgs(f func(string) error) error {
|
|||||||
return nil
|
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 {
|
func (r *request) InvocContext() *Context {
|
||||||
return &r.ctx
|
return &r.ctx
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user