mirror of
https://github.com/containerd/containerd.git
synced 2026-08-08 00:51:50 +00:00
fix: ST1001: should not use dot imports (staticcheck)
Signed-off-by: yashsingh74 <yashsingh1774@gmail.com>
(cherry picked from commit 4ba81d4296)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
Sebastiaan van Stijn
parent
4ed50edce7
commit
f6ddff11bb
@@ -28,9 +28,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/v2/client"
|
||||
"github.com/containerd/plugin"
|
||||
|
||||
. "github.com/containerd/containerd/v2/client"
|
||||
)
|
||||
|
||||
type daemon struct {
|
||||
@@ -58,31 +57,31 @@ func (d *daemon) start(name, address string, args []string, stdout, stderr io.Wr
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *daemon) waitForStart(ctx context.Context) (*Client, error) {
|
||||
func (d *daemon) waitForStart(ctx context.Context) (*client.Client, error) {
|
||||
var (
|
||||
client *Client
|
||||
serving bool
|
||||
err error
|
||||
ticker = time.NewTicker(500 * time.Millisecond)
|
||||
clientInstance *client.Client
|
||||
serving bool
|
||||
err error
|
||||
ticker = time.NewTicker(500 * time.Millisecond)
|
||||
)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
client, err = New(d.addr)
|
||||
clientInstance, err = client.New(d.addr)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
serving, err = client.IsServing(ctx)
|
||||
serving, err = clientInstance.IsServing(ctx)
|
||||
if !serving {
|
||||
client.Close()
|
||||
clientInstance.Close()
|
||||
if err == nil {
|
||||
err = errors.New("connection was successful but service is not available")
|
||||
}
|
||||
continue
|
||||
}
|
||||
resp, perr := client.IntrospectionService().Plugins(ctx)
|
||||
resp, perr := clientInstance.IntrospectionService().Plugins(ctx)
|
||||
if perr != nil {
|
||||
return nil, fmt.Errorf("failed to get plugin list: %w", perr)
|
||||
}
|
||||
@@ -97,7 +96,7 @@ func (d *daemon) waitForStart(ctx context.Context) (*Client, error) {
|
||||
return nil, loadErr
|
||||
}
|
||||
|
||||
return client, err
|
||||
return clientInstance, err
|
||||
case <-ctx.Done():
|
||||
return nil, fmt.Errorf("context deadline exceeded: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user