From 2f957864eaf50b4e32dc4e5a41cd3f26dd3994f7 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Tue, 29 Aug 2017 20:26:37 -0700 Subject: [PATCH 1/2] host-local disk backend store uses FileLock by reference - this change fixes go vet warnings for the package --- plugins/ipam/host-local/backend/disk/backend.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ipam/host-local/backend/disk/backend.go b/plugins/ipam/host-local/backend/disk/backend.go index 82c3a8a9..0f5a5f53 100644 --- a/plugins/ipam/host-local/backend/disk/backend.go +++ b/plugins/ipam/host-local/backend/disk/backend.go @@ -31,7 +31,7 @@ var defaultDataDir = "/var/lib/cni/networks" // Store is a simple disk-backed store that creates one file per IP // address in a given directory. The contents of the file are the container ID. type Store struct { - FileLock + *FileLock dataDir string } @@ -51,7 +51,7 @@ func New(network, dataDir string) (*Store, error) { if err != nil { return nil, err } - return &Store{*lk, dir}, nil + return &Store{lk, dir}, nil } func (s *Store) Reserve(id string, ip net.IP, rangeID string) (bool, error) { From 92e62b9f4db69983d4c3783cf1c2f885cafa6d13 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Tue, 29 Aug 2017 20:43:42 -0700 Subject: [PATCH 2/2] test.sh: cover host-local disk backend for go test and go vet --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 8a4dad95..861d9cc1 100755 --- a/test.sh +++ b/test.sh @@ -10,7 +10,7 @@ source ./build.sh echo "Running tests" -TESTABLE="plugins/ipam/dhcp plugins/ipam/host-local plugins/ipam/host-local/backend/allocator plugins/main/loopback plugins/main/ipvlan plugins/main/macvlan plugins/main/bridge plugins/main/ptp plugins/meta/flannel plugins/main/vlan plugins/sample pkg/ip pkg/ipam pkg/ns pkg/utils pkg/utils/hwaddr pkg/utils/sysctl plugins/meta/portmap" +TESTABLE="plugins/ipam/dhcp plugins/ipam/host-local plugins/ipam/host-local/backend/allocator plugins/ipam/host-local/backend/disk plugins/main/loopback plugins/main/ipvlan plugins/main/macvlan plugins/main/bridge plugins/main/ptp plugins/meta/flannel plugins/main/vlan plugins/sample pkg/ip pkg/ipam pkg/ns pkg/utils pkg/utils/hwaddr pkg/utils/sysctl plugins/meta/portmap" # user has not provided PKG override if [ -z "$PKG" ]; then