From eac2625797f47d3c7ab27160784d70f13c67a184 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Thu, 30 Dec 2021 21:23:28 +0100 Subject: [PATCH] Changed WithNodeIDs(ids []uint32) to ids ...uint32 This makes it easier to use with single entry node IDs. --- config_opts.go | 2 +- config_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config_opts.go b/config_opts.go index 91474e2c..509e2fb5 100644 --- a/config_opts.go +++ b/config_opts.go @@ -107,7 +107,7 @@ func (o nodeIDs) newConfig(mgr *Manager) (nodes Configuration, err error) { // WithNodeIDs returns a NodeListOption containing a list of node IDs. // This assumes that the provided node IDs have already been registered with the manager. -func WithNodeIDs(ids []uint32) NodeListOption { +func WithNodeIDs(ids ...uint32) NodeListOption { return &nodeIDs{nodeIDs: ids} } diff --git a/config_test.go b/config_test.go index 7b73a0c0..664b0c30 100644 --- a/config_test.go +++ b/config_test.go @@ -79,7 +79,7 @@ func TestNewConfigurationNodeIDs(t *testing.T) { // Identical configurations c1 == c2 nodeIDs := c1.NodeIDs() - c2, err := gorums.NewConfiguration(mgr, gorums.WithNodeIDs(nodeIDs)) + c2, err := gorums.NewConfiguration(mgr, gorums.WithNodeIDs(nodeIDs...)) if err != nil { t.Fatal(err) } @@ -91,7 +91,7 @@ func TestNewConfigurationNodeIDs(t *testing.T) { } // Configuration with one less node |c3| == |c1| - 1 - c3, err := gorums.NewConfiguration(mgr, gorums.WithNodeIDs(nodeIDs[:len(nodeIDs)-1])) + c3, err := gorums.NewConfiguration(mgr, gorums.WithNodeIDs(nodeIDs[:len(nodeIDs)-1]...)) if err != nil { t.Fatal(err) }