diff --git a/.appveyor.yml b/.appveyor.yml index 16198f6a7..8650ef08e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,15 +18,17 @@ before_build: #- choco install codecov build_script: - - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe fmt" - - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe vet" - - bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe build" - - bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe binaries" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe setup" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe fmt" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe vet" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:/c/gopath/bin:$PATH ; mingw32-make.exe ineffassign" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe build" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe binaries" test_script: # TODO: need an equivalent of TRAVIS_COMMIT_RANGE # - GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" C:\MinGW\bin\mingw32-make.exe dco - - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe integration" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe integration" # TODO: re-enable once the content unit-test have been updated to pass on windows #- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe coverage" #- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe root-coverage" diff --git a/.travis.yml b/.travis.yml index 7df354b88..e118aa959 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ addons: - libprotobuf-dev env: - - TRAVIS_GOOS=windows TRAVIS_CGO_ENABLED=1 - TRAVIS_GOOS=linux TRAVIS_CGO_ENABLED=1 - TRAVIS_GOOS=darwin TRAVIS_CGO_ENABLED=0 @@ -36,7 +35,6 @@ before_install: - uname -r install: - - if [ "$TRAVIS_GOOS" = "windows" ] ; then sudo apt-get install -y gcc-multilib gcc-mingw-w64; export CC=x86_64-w64-mingw32-gcc ; export CXX=x86_64-w64-mingw32-g++ ; fi - wget https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip -O /tmp/protoc-3.1.0-linux-x86_64.zip - unzip -o -d /tmp/protobuf /tmp/protoc-3.1.0-linux-x86_64.zip - export PATH=$PATH:/tmp/protobuf/bin/ @@ -55,7 +53,9 @@ script: # FIXME: For non-linux GOOS, without running `go build -i`, vet fails with `vet: import failed: can't find import: fmt`... # Note that `go build -i` requires write permission to GOROOT. (So it is not called in Makefile) - go build -i . + - make setup - make vet + - make ineffassign - make build - make binaries - if [ "$GOOS" = "linux" ]; then sudo make install ; fi diff --git a/cmd/ctr/utils.go b/cmd/ctr/utils.go index 70270c4ea..7e827b49f 100644 --- a/cmd/ctr/utils.go +++ b/cmd/ctr/utils.go @@ -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) diff --git a/container_test.go b/container_test.go index 3cde907c5..f621cdae9 100644 --- a/container_test.go +++ b/container_test.go @@ -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 } diff --git a/progress/bar.go b/progress/bar.go index fa916efcb..ced8862ef 100644 --- a/progress/bar.go +++ b/progress/bar.go @@ -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) diff --git a/remotes/docker/schema1/converter.go b/remotes/docker/schema1/converter.go index 4459ce94f..7d24d156f 100644 --- a/remotes/docker/schema1/converter.go +++ b/remotes/docker/schema1/converter.go @@ -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) diff --git a/snapshot/overlay/overlay_test.go b/snapshot/overlay/overlay_test.go index 1bd9d923d..5b47f07ae 100644 --- a/snapshot/overlay/overlay_test.go +++ b/snapshot/overlay/overlay_test.go @@ -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