mirror of
https://github.com/crazy-max/diun.git
synced 2026-01-04 03:55:00 +01:00
lint: fix issues
This commit is contained in:
@@ -68,7 +68,7 @@ func newInClusterClient(opts Options) (*kubernetes.Clientset, error) {
|
||||
config.Host = opts.Endpoint
|
||||
}
|
||||
if opts.TLSInsecure != nil {
|
||||
config.TLSClientConfig.Insecure = *opts.TLSInsecure
|
||||
config.Insecure = *opts.TLSInsecure
|
||||
}
|
||||
|
||||
return kubernetes.NewForConfig(config)
|
||||
@@ -80,7 +80,7 @@ func newExternalClusterClientFromFile(opts Options, file string) (*kubernetes.Cl
|
||||
return nil, err
|
||||
}
|
||||
if opts.TLSInsecure != nil {
|
||||
configFromFlags.TLSClientConfig.Insecure = *opts.TLSInsecure
|
||||
configFromFlags.Insecure = *opts.TLSInsecure
|
||||
}
|
||||
|
||||
return kubernetes.NewForConfig(configFromFlags)
|
||||
@@ -113,7 +113,7 @@ func newExternalClusterClient(opts Options) (*kubernetes.Clientset, error) {
|
||||
}
|
||||
}
|
||||
if opts.TLSInsecure != nil {
|
||||
config.TLSClientConfig.Insecure = *opts.TLSInsecure
|
||||
config.Insecure = *opts.TLSInsecure
|
||||
}
|
||||
|
||||
return kubernetes.NewForConfig(config)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Client represents an active docker registry object
|
||||
@@ -43,9 +44,11 @@ func New(opts Options) (*Client, error) {
|
||||
|
||||
func (c *Client) timeoutContext() (context.Context, context.CancelFunc) {
|
||||
ctx := context.Background()
|
||||
var cancel context.CancelFunc = func() {}
|
||||
var cancelFunc context.CancelFunc = func() {}
|
||||
if c.opts.Timeout > 0 {
|
||||
ctx, cancel = context.WithTimeout(ctx, c.opts.Timeout)
|
||||
cancelCtx, cancel := context.WithCancelCause(ctx)
|
||||
ctx, _ = context.WithTimeoutCause(cancelCtx, c.opts.Timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent
|
||||
cancelFunc = func() { cancel(errors.WithStack(context.Canceled)) }
|
||||
}
|
||||
return ctx, cancel
|
||||
return ctx, cancelFunc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user