Skip to content

Commit

Permalink
Changed WithNodeIDs(ids []uint32) to ids ...uint32
Browse files Browse the repository at this point in the history
This makes it easier to use with single entry node IDs.
  • Loading branch information
meling committed Dec 30, 2021
1 parent 15a2140 commit eac2625
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}

Expand Down
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit eac2625

Please sign in to comment.