Fix ineffassign warnings

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-08-01 14:42:41 -07:00
parent 789330033a
commit 829845d268
No known key found for this signature in database
GPG Key ID: 40CF16616B361216
5 changed files with 11 additions and 5 deletions

View File

@ -87,7 +87,7 @@ func appContext(clicontext *cli.Context) (gocontext.Context, gocontext.CancelFun
ctx = gocontext.Background()
timeout = clicontext.GlobalDuration("timeout")
namespace = clicontext.GlobalString("namespace")
cancel = func() {}
cancel gocontext.CancelFunc
)
ctx = namespaces.WithNamespace(ctx, namespace)

View File

@ -69,7 +69,7 @@ func TestNewContainer(t *testing.T) {
if container.ID() != id {
t.Errorf("expected container id %q but received %q", id, container.ID())
}
if spec, err = container.Spec(); err != nil {
if _, err = container.Spec(); err != nil {
t.Error(err)
return
}

View File

@ -58,7 +58,7 @@ func (h Bar) Format(state fmt.State, r rune) {
n += copy(p[n:], []byte(reset))
if negative > 0 {
n += copy(p[n:len(p)-1], bytes.Repeat([]byte("-"), negative))
copy(p[n:len(p)-1], bytes.Repeat([]byte("-"), negative))
}
state.Write(p)

View File

@ -217,6 +217,9 @@ func (c *Converter) fetchBlob(ctx context.Context, desc ocispec.Descriptor) erro
defer r.Close()
gr, err := gzip.NewReader(r)
if err != nil {
return err
}
defer gr.Close()
_, err = io.Copy(calc, gr)
@ -237,6 +240,9 @@ func (c *Converter) fetchBlob(ctx context.Context, desc ocispec.Descriptor) erro
eg.Go(func() error {
gr, err := gzip.NewReader(pr)
if err != nil {
return err
}
defer gr.Close()
_, err = io.Copy(calc, gr)

View File

@ -110,8 +110,7 @@ func TestOverlayOverlayMount(t *testing.T) {
return
}
key := "/tmp/test"
mounts, err := o.Prepare(ctx, key, "")
if err != nil {
if _, err = o.Prepare(ctx, key, ""); err != nil {
t.Error(err)
return
}
@ -119,6 +118,7 @@ func TestOverlayOverlayMount(t *testing.T) {
t.Error(err)
return
}
var mounts []mount.Mount
if mounts, err = o.Prepare(ctx, "/tmp/layer2", "base"); err != nil {
t.Error(err)
return