ipc: Add some type checking statements

Change-Id: I20547b932efc89352a33c6307e01fda9590c6db6
diff --git a/lib/modules/core/echo.go b/lib/modules/core/echo.go
index 459e7fe..4a2e5a5 100644
--- a/lib/modules/core/echo.go
+++ b/lib/modules/core/echo.go
@@ -21,6 +21,8 @@
 
 type treeDispatcher struct{ id string }
 
+var _ ipc.Dispatcher = (*treeDispatcher)(nil)
+
 func (d treeDispatcher) Lookup(suffix, method string) (ipc.Invoker, security.Authorizer, error) {
 	return ipc.ReflectInvoker(&echoServerObject{d.id, suffix}), nil, nil
 }
diff --git a/profiles/generic.go b/profiles/generic.go
index 3edb753..e9d4817 100644
--- a/profiles/generic.go
+++ b/profiles/generic.go
@@ -17,6 +17,8 @@
 
 type generic struct{}
 
+var _ veyron2.Profile = (*generic)(nil)
+
 // New returns a new instance of a very generic Profile. It can be used
 // as a default by Runtime implementations, in unit tests etc.
 func New() veyron2.Profile {
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 0e9c171..f75ee6a 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -47,6 +47,9 @@
 	dischargeCache dischargeCache
 }
 
+var _ ipc.Client = (*client)(nil)
+var _ ipc.BindOpt = (*client)(nil)
+
 type vcInfo struct {
 	vc       stream.VC
 	remoteEP naming.Endpoint
@@ -346,8 +349,6 @@
 	//nologcall
 }
 
-var _ ipc.BindOpt = (*client)(nil)
-
 // flowClient implements the RPC client-side protocol for a single RPC, over a
 // flow that's already connected to the server.
 type flowClient struct {
@@ -367,6 +368,9 @@
 	finished bool // has Finish() already been called?
 }
 
+var _ ipc.Call = (*flowClient)(nil)
+var _ ipc.Stream = (*flowClient)(nil)
+
 func newFlowClient(ctx context.T, server []string, flow stream.Flow, dischargeCache *dischargeCache, discharges []security.Discharge) *flowClient {
 	return &flowClient{
 		ctx:            ctx,
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 4a651ca..610e2a6 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -61,6 +61,8 @@
 	stats *ipcStats // stats for this server.
 }
 
+var _ ipc.Server = (*server)(nil)
+
 type dhcpListener struct {
 	sync.Mutex
 	publisher *config.Publisher // publisher used to fork the stream
@@ -578,6 +580,8 @@
 	allowDebug         bool // true if the caller is permitted to view debug information.
 }
 
+var _ ipc.Stream = (*flowServer)(nil)
+
 func newFlowServer(flow stream.Flow, server *server) *flowServer {
 	server.Lock()
 	disp := server.disp
@@ -914,6 +918,10 @@
 	prefix string
 }
 
+var _ ipc.ServerCall = (*localServerCall)(nil)
+var _ ipc.Stream = (*localServerCall)(nil)
+var _ ipc.ServerContext = (*localServerCall)(nil)
+
 func (c *localServerCall) Send(v interface{}) error {
 	me, ok := v.(mttypes.MountEntry)
 	if !ok {
diff --git a/runtimes/google/ipc/stream/manager/listener.go b/runtimes/google/ipc/stream/manager/listener.go
index ef09914..0d67c12 100644
--- a/runtimes/google/ipc/stream/manager/listener.go
+++ b/runtimes/google/ipc/stream/manager/listener.go
@@ -39,6 +39,8 @@
 	vifLoops sync.WaitGroup
 }
 
+var _ stream.Listener = (*netListener)(nil)
+
 // proxyListener implements the listener interface by connecting to a remote
 // proxy (typically used to "listen" across network domains).
 type proxyListener struct {
@@ -48,6 +50,8 @@
 	opts    []stream.ListenerOpt
 }
 
+var _ stream.Listener = (*proxyListener)(nil)
+
 func newNetListener(m *manager, netLn net.Listener, opts []stream.ListenerOpt) listener {
 	ln := &netListener{
 		q:       upcqueue.New(),
diff --git a/runtimes/google/ipc/stream/manager/manager.go b/runtimes/google/ipc/stream/manager/manager.go
index fc5491f..7afdad3 100644
--- a/runtimes/google/ipc/stream/manager/manager.go
+++ b/runtimes/google/ipc/stream/manager/manager.go
@@ -46,6 +46,8 @@
 	shutdown    bool              // GUARDED_BY(muListeners)
 }
 
+var _ stream.Manager = (*manager)(nil)
+
 func dial(network, address string) (net.Conn, error) {
 	if d, _ := stream.RegisteredProtocol(network); d != nil {
 		return d(address)
diff --git a/runtimes/google/ipc/stream/vc/flow.go b/runtimes/google/ipc/stream/vc/flow.go
index 1f5a843..1523736 100644
--- a/runtimes/google/ipc/stream/vc/flow.go
+++ b/runtimes/google/ipc/stream/vc/flow.go
@@ -3,6 +3,7 @@
 import (
 	"net"
 
+	"veyron.io/veyron/veyron2/ipc/stream"
 	"veyron.io/veyron/veyron2/naming"
 	"veyron.io/veyron/veyron2/security"
 )
@@ -14,6 +15,8 @@
 	localEndpoint, remoteEndpoint naming.Endpoint
 }
 
+var _ stream.Flow = (*flow)(nil)
+
 type idHolder interface {
 	LocalID() security.PublicID
 	RemoteID() security.PublicID
diff --git a/runtimes/google/ipc/stream/vc/listener.go b/runtimes/google/ipc/stream/vc/listener.go
index b344020..a2d3f8f 100644
--- a/runtimes/google/ipc/stream/vc/listener.go
+++ b/runtimes/google/ipc/stream/vc/listener.go
@@ -13,6 +13,8 @@
 	q *upcqueue.T
 }
 
+var _ stream.Listener = (*listener)(nil)
+
 func newListener() *listener { return &listener{q: upcqueue.New()} }
 
 func (l *listener) Enqueue(f stream.Flow) error {
diff --git a/runtimes/google/ipc/stream/vc/vc.go b/runtimes/google/ipc/stream/vc/vc.go
index 55a45ea..f0b4ad9 100644
--- a/runtimes/google/ipc/stream/vc/vc.go
+++ b/runtimes/google/ipc/stream/vc/vc.go
@@ -62,6 +62,8 @@
 	version version.IPCVersion
 }
 
+var _ stream.VC = (*VC)(nil)
+
 // Helper is the interface for functionality required by the stream.VC
 // implementation in this package.
 type Helper interface {
diff --git a/runtimes/google/rt/rt.go b/runtimes/google/rt/rt.go
index cb0bda2..fa8ab10 100644
--- a/runtimes/google/rt/rt.go
+++ b/runtimes/google/rt/rt.go
@@ -41,6 +41,8 @@
 	cleaningUp bool // GUARDED_BY(mu)
 }
 
+var _ veyron2.Runtime = (*vrt)(nil)
+
 // Implements veyron2/rt.New
 func New(opts ...veyron2.ROpt) (veyron2.Runtime, error) {
 	rt := &vrt{mgmt: new(mgmtImpl)}
diff --git a/services/identity/identityd/main.go b/services/identity/identityd/main.go
index eef94c2..9ca7299 100644
--- a/services/identity/identityd/main.go
+++ b/services/identity/identityd/main.go
@@ -171,6 +171,8 @@
 	auth     security.Authorizer
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 func (d dispatcher) Lookup(suffix, method string) (ipc.Invoker, security.Authorizer, error) {
 	if invoker := d.invokers[suffix]; invoker != nil {
 		return invoker, d.auth, nil
diff --git a/services/mgmt/application/impl/dispatcher.go b/services/mgmt/application/impl/dispatcher.go
index 5a08493..f2b8793 100644
--- a/services/mgmt/application/impl/dispatcher.go
+++ b/services/mgmt/application/impl/dispatcher.go
@@ -15,6 +15,8 @@
 	storeRoot string
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 // NewDispatcher is the dispatcher factory.
 func NewDispatcher(name string, authorizer security.Authorizer) (*dispatcher, error) {
 	// TODO(rjkroege@google.com): Use the config service.
diff --git a/services/mgmt/debug/dispatcher.go b/services/mgmt/debug/dispatcher.go
index 7287f0b..df7c301 100644
--- a/services/mgmt/debug/dispatcher.go
+++ b/services/mgmt/debug/dispatcher.go
@@ -19,6 +19,8 @@
 	auth    security.Authorizer
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 func NewDispatcher(logsDir string, authorizer security.Authorizer) *dispatcher {
 	return &dispatcher{logsDir, authorizer}
 }
diff --git a/services/mgmt/node/impl/dispatcher.go b/services/mgmt/node/impl/dispatcher.go
index 26869a5..b63ea47 100644
--- a/services/mgmt/node/impl/dispatcher.go
+++ b/services/mgmt/node/impl/dispatcher.go
@@ -52,6 +52,8 @@
 	mu sync.RWMutex
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 const (
 	appsSuffix   = "apps"
 	nodeSuffix   = "nm"
diff --git a/services/mgmt/profile/impl/dispatcher.go b/services/mgmt/profile/impl/dispatcher.go
index 9169da1..819688b 100644
--- a/services/mgmt/profile/impl/dispatcher.go
+++ b/services/mgmt/profile/impl/dispatcher.go
@@ -15,6 +15,8 @@
 	storeRoot string
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 // NewDispatcher is the dispatcher factory.
 func NewDispatcher(name string, authorizer security.Authorizer) (*dispatcher, error) {
 	// TODO(rjkroege@google.com): Use the config service.
diff --git a/services/mgmt/root/impl/dispatcher.go b/services/mgmt/root/impl/dispatcher.go
index 67e002a..a0058be 100644
--- a/services/mgmt/root/impl/dispatcher.go
+++ b/services/mgmt/root/impl/dispatcher.go
@@ -11,6 +11,8 @@
 	state *invoker
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 // NewDispatcher is the dispatcher factory.
 func NewDispatcher() *dispatcher {
 	return &dispatcher{NewInvoker()}
diff --git a/services/mounttable/lib/mounttable.go b/services/mounttable/lib/mounttable.go
index 2a1376d..b5db89c 100644
--- a/services/mounttable/lib/mounttable.go
+++ b/services/mounttable/lib/mounttable.go
@@ -33,6 +33,8 @@
 	acls map[string]security.Authorizer
 }
 
+var _ ipc.Dispatcher = (*mountTable)(nil)
+
 // mountContext represents a client bind.  The name is the name that was bound to.
 type mountContext struct {
 	name         string
@@ -92,7 +94,7 @@
 	return result, nil
 }
 
-// LookupServer implements ipc.Dispatcher.Lookup.
+// Lookup implements ipc.Dispatcher.Lookup.
 func (mt *mountTable) Lookup(name, method string) (ipc.Invoker, security.Authorizer, error) {
 	vlog.VI(2).Infof("*********************Lookup %s", name)
 	mt.RLock()
diff --git a/services/mounttable/lib/neighborhood.go b/services/mounttable/lib/neighborhood.go
index 0381352..17def5e 100644
--- a/services/mounttable/lib/neighborhood.go
+++ b/services/mounttable/lib/neighborhood.go
@@ -29,6 +29,8 @@
 	nw     netconfig.NetConfigWatcher
 }
 
+var _ ipc.Dispatcher = (*neighborhood)(nil)
+
 type neighborhoodService struct {
 	name  string
 	elems []string
diff --git a/services/wsprd/ipc/server/dispatcher.go b/services/wsprd/ipc/server/dispatcher.go
index ca83e40..489ecf1 100644
--- a/services/wsprd/ipc/server/dispatcher.go
+++ b/services/wsprd/ipc/server/dispatcher.go
@@ -53,6 +53,8 @@
 	outstandingLookups map[int64]chan lookupReply
 }
 
+var _ ipc.Dispatcher = (*dispatcher)(nil)
+
 // newDispatcher is a dispatcher factory.
 func newDispatcher(serverID uint64, flowFactory flowFactory, invokerFactory invokerFactory, authFactory authFactory, logger vlog.Logger) *dispatcher {
 	return &dispatcher{
diff --git a/services/wsprd/ipc/server/invoker.go b/services/wsprd/ipc/server/invoker.go
index 2f7736d..9b6c099 100644
--- a/services/wsprd/ipc/server/invoker.go
+++ b/services/wsprd/ipc/server/invoker.go
@@ -21,6 +21,8 @@
 	label security.Label
 }
 
+var _ ipc.Invoker = (*invoker)(nil)
+
 // newInvoker is an invoker factory
 func newInvoker(sig ipc.ServiceSignature, label security.Label, invokeFunc remoteInvokeFunc) ipc.Invoker {
 	predefinedInvokers := make(map[string]ipc.Invoker)
diff --git a/services/wsprd/ipc/server/signature_invoker.go b/services/wsprd/ipc/server/signature_invoker.go
index 55c9962..bd2d786 100644
--- a/services/wsprd/ipc/server/signature_invoker.go
+++ b/services/wsprd/ipc/server/signature_invoker.go
@@ -12,6 +12,8 @@
 	sig ipc.ServiceSignature
 }
 
+var _ ipc.Invoker = (*signatureInvoker)(nil)
+
 func (i *signatureInvoker) signature() ipc.ServiceSignature {
 	return i.sig
 }