all: assert internal objects implement interfaces
authorDan Williams <dcbw@redhat.com>
Wed, 14 Dec 2016 23:09:01 +0000 (17:09 -0600)
committerDan Williams <dcbw@redhat.com>
Wed, 14 Dec 2016 23:09:01 +0000 (17:09 -0600)
libcni/api.go
pkg/invoke/args.go
pkg/ns/ns.go
pkg/version/plugin.go
plugins/ipam/host-local/backend/disk/backend.go
plugins/ipam/host-local/backend/testing/fake_store.go

index 8ba78b2..dfc30ca 100644 (file)
@@ -43,6 +43,9 @@ type CNIConfig struct {
        Path []string
 }
 
+// CNIConfig implements the CNI interface
+var _ CNI = &CNIConfig{}
+
 // AddNetwork executes the plugin with the ADD command
 func (c *CNIConfig) AddNetwork(net *NetworkConfig, rt *RuntimeConf) (*types.Result, error) {
        pluginPath, err := invoke.FindInPath(net.Network.Type, c.Path)
index be28ba6..ba9d0c3 100644 (file)
@@ -47,6 +47,9 @@ type Args struct {
        Path          string
 }
 
+// Args implements the CNIArgs interface
+var _ CNIArgs = &Args{}
+
 func (args *Args) AsEnv() []string {
        env := os.Environ()
        pluginArgsStr := args.PluginArgsStr
index 3246ebf..220dd69 100644 (file)
@@ -62,6 +62,9 @@ type netNS struct {
        closed  bool
 }
 
+// netNS implements the NetNS interface
+var _ NetNS = &netNS{}
+
 func getCurrentThreadNetNSPath() string {
        // /proc/self/ns/net returns the namespace of the main thread, not
        // of whatever thread this goroutine is running on.  Make sure we
index dc937b5..8a46728 100644 (file)
@@ -36,6 +36,9 @@ type pluginInfo struct {
        SupportedVersions_ []string `json:"supportedVersions,omitempty"`
 }
 
+// pluginInfo implements the PluginInfo interface
+var _ PluginInfo = &pluginInfo{}
+
 func (p *pluginInfo) Encode(w io.Writer) error {
        return json.NewEncoder(w).Encode(p)
 }
index 14dd40d..106c2da 100644 (file)
@@ -20,6 +20,8 @@ import (
        "net"
        "os"
        "path/filepath"
+
+       "github.com/containernetworking/cni/plugins/ipam/host-local/backend"
 )
 
 const lastIPFile = "last_reserved_ip"
@@ -31,6 +33,9 @@ type Store struct {
        dataDir string
 }
 
+// Store implements the Store interface
+var _ backend.Store = &Store{}
+
 func New(network, dataDir string) (*Store, error) {
        if dataDir == "" {
                dataDir = defaultDataDir
index f7750ca..0a2b5ca 100644 (file)
@@ -16,6 +16,8 @@ package testing
 
 import (
        "net"
+
+       "github.com/containernetworking/cni/plugins/ipam/host-local/backend"
 )
 
 type FakeStore struct {
@@ -23,6 +25,9 @@ type FakeStore struct {
        lastReservedIP net.IP
 }
 
+// FakeStore implements the Store interface
+var _ backend.Store = &FakeStore{}
+
 func NewFakeStore(ipmap map[string]string, lastIP net.IP) *FakeStore {
        return &FakeStore{ipmap, lastIP}
 }