Since go 1.7, "context" is a standard package. Since go 1.9,
x/net/context merely provides some types aliased to those in
the standard context package.
The changes were performed by the following script:
for f in $(git ls-files \*.go | grep -v ^vendor/); do
sed -i 's|golang.org/x/net/context|context|' $f
goimports -w $f
for i in 1 2; do
awk '/^$/ {e=1; next;}
/\t"context"$/ {e=0;}
{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
mv $f.new $f
goimports -w $f
done
done
[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package volume
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/filters"
|
|
volumetypes "github.com/docker/docker/api/types/volume"
|
|
"github.com/docker/docker/client"
|
|
)
|
|
|
|
type fakeClient struct {
|
|
client.Client
|
|
volumeCreateFunc func(volumetypes.VolumesCreateBody) (types.Volume, error)
|
|
volumeInspectFunc func(volumeID string) (types.Volume, error)
|
|
volumeListFunc func(filter filters.Args) (volumetypes.VolumesListOKBody, error)
|
|
volumeRemoveFunc func(volumeID string, force bool) error
|
|
volumePruneFunc func(filter filters.Args) (types.VolumesPruneReport, error)
|
|
}
|
|
|
|
func (c *fakeClient) VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error) {
|
|
if c.volumeCreateFunc != nil {
|
|
return c.volumeCreateFunc(options)
|
|
}
|
|
return types.Volume{}, nil
|
|
}
|
|
|
|
func (c *fakeClient) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {
|
|
if c.volumeInspectFunc != nil {
|
|
return c.volumeInspectFunc(volumeID)
|
|
}
|
|
return types.Volume{}, nil
|
|
}
|
|
|
|
func (c *fakeClient) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error) {
|
|
if c.volumeListFunc != nil {
|
|
return c.volumeListFunc(filter)
|
|
}
|
|
return volumetypes.VolumesListOKBody{}, nil
|
|
}
|
|
|
|
func (c *fakeClient) VolumesPrune(ctx context.Context, filter filters.Args) (types.VolumesPruneReport, error) {
|
|
if c.volumePruneFunc != nil {
|
|
return c.volumePruneFunc(filter)
|
|
}
|
|
return types.VolumesPruneReport{}, nil
|
|
}
|
|
|
|
func (c *fakeClient) VolumeRemove(ctx context.Context, volumeID string, force bool) error {
|
|
if c.volumeRemoveFunc != nil {
|
|
return c.volumeRemoveFunc(volumeID, force)
|
|
}
|
|
return nil
|
|
}
|