Merge pull request #1275 from mlaventure/travis-ineffassign

Enable ineffassign in CI
This commit is contained in:
Michael Crosby 2017-08-07 09:21:53 -04:00 committed by GitHub
commit 60f7eee27b
7 changed files with 20 additions and 12 deletions

View File

@ -18,15 +18,17 @@ before_build:
#- choco install codecov #- choco install codecov
build_script: 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 -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe setup"
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe vet" - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe fmt"
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe build" - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe vet"
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe binaries" - 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: test_script:
# TODO: need an equivalent of TRAVIS_COMMIT_RANGE # 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 # - 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 # 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 coverage"
#- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe root-coverage" #- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe root-coverage"

View File

@ -28,7 +28,6 @@ addons:
- libprotobuf-dev - libprotobuf-dev
env: env:
- TRAVIS_GOOS=windows TRAVIS_CGO_ENABLED=1
- TRAVIS_GOOS=linux TRAVIS_CGO_ENABLED=1 - TRAVIS_GOOS=linux TRAVIS_CGO_ENABLED=1
- TRAVIS_GOOS=darwin TRAVIS_CGO_ENABLED=0 - TRAVIS_GOOS=darwin TRAVIS_CGO_ENABLED=0
@ -36,7 +35,6 @@ before_install:
- uname -r - uname -r
install: 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 - 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 - unzip -o -d /tmp/protobuf /tmp/protoc-3.1.0-linux-x86_64.zip
- export PATH=$PATH:/tmp/protobuf/bin/ - 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`... # 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) # Note that `go build -i` requires write permission to GOROOT. (So it is not called in Makefile)
- go build -i . - go build -i .
- make setup
- make vet - make vet
- make ineffassign
- make build - make build
- make binaries - make binaries
- if [ "$GOOS" = "linux" ]; then sudo make install ; fi - if [ "$GOOS" = "linux" ]; then sudo make install ; fi

View File

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

View File

@ -69,7 +69,7 @@ func TestNewContainer(t *testing.T) {
if container.ID() != id { if container.ID() != id {
t.Errorf("expected container id %q but received %q", id, container.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) t.Error(err)
return return
} }

View File

@ -58,7 +58,7 @@ func (h Bar) Format(state fmt.State, r rune) {
n += copy(p[n:], []byte(reset)) n += copy(p[n:], []byte(reset))
if negative > 0 { 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) state.Write(p)

View File

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

View File

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