From db60e32f30275bb3ea92b9c6652e82dde30fcf4b Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Tue, 12 Dec 2017 11:19:02 +0000 Subject: [PATCH 1/2] Enable Travis builds This commit adds a .travis file which enables Travis builds for govmm. The script builds the source and runs the unit tests and gometalinter enabling - misspell - vet - ineffassign - gofmt - gocyclo 15 - golint - errcheck - deadcode Signed-off-by: Mark Ryan --- .travis.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..36f4b30f08 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: go + +go: + - 1.8 + - 1.9 + - tip + +go_import_path: github.com/intel/govmm + +matrix: + allow_failures: + - go: tip + +before_install: + - go get github.com/alecthomas/gometalinter + - gometalinter --install + +script: + - go env + - go test -v ./... + - gometalinter --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=errcheck --enable=deadcode ./... From d74e3b66338c190688b3cd7a898426fb55f42dbf Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Tue, 12 Dec 2017 11:51:17 +0000 Subject: [PATCH 2/2] Fix errcheck failures in the unit tests There were some unchecked errors in some of the unit files relating to the closure and removal of temporary files. As the closure and removal of these files is not really important to whether the next passes or fails we ignore the errors. Signed-off-by: Mark Ryan --- qemu/qemu_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qemu/qemu_test.go b/qemu/qemu_test.go index 8a97fd1d54..51269eabbf 100644 --- a/qemu/qemu_test.go +++ b/qemu/qemu_test.go @@ -146,10 +146,10 @@ func TestAppendDeviceNetworkMq(t *testing.T) { bar, _ := ioutil.TempFile(os.TempDir(), "govmm-qemu-test") defer func() { - foo.Close() - bar.Close() - os.Remove(foo.Name()) - os.Remove(bar.Name()) + _ = foo.Close() + _ = bar.Close() + _ = os.Remove(foo.Name()) + _ = os.Remove(bar.Name()) }() netdev := NetDevice{ @@ -196,10 +196,10 @@ func TestAppendDeviceNetworkPCIMq(t *testing.T) { bar, _ := ioutil.TempFile(os.TempDir(), "govmm-qemu-test") defer func() { - foo.Close() - bar.Close() - os.Remove(foo.Name()) - os.Remove(bar.Name()) + _ = foo.Close() + _ = bar.Close() + _ = os.Remove(foo.Name()) + _ = os.Remove(bar.Name()) }() netdev := NetDevice{