From 2fd6e256a27812c8dab4cce19b756213ce8c69bf Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 16 Nov 2018 09:25:50 +0000
Subject: [PATCH] Calling a sharded service without a shard is now an error

---
 clientutil/balancer.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clientutil/balancer.go b/clientutil/balancer.go
index 9d9b7dd..f53b68e 100644
--- a/clientutil/balancer.go
+++ b/clientutil/balancer.go
@@ -104,7 +104,10 @@ func (b *balancedBackend) Call(ctx context.Context, shard, path string, req, res
 	}
 
 	var tg targetGenerator = b.backendTracker
-	if b.sharded && shard != "" {
+	if b.sharded {
+		if shard == "" {
+			return fmt.Errorf("call without shard to sharded service %s", b.baseURI.String())
+		}
 		tg = newShardedGenerator(shard, b.baseURI.Host, b.resolver)
 	}
 	seq := newSequence(tg)
-- 
GitLab