You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: nodes.go
    path of file: ./repos/cockroach/pkg/roachprod/install
    
    the code of the file until where you have to start completion: // Copyright 2018 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package install

import (
	"fmt"
	"strconv"
	"strings"

	"github.com/cockroachdb/cockroach/pkg/util/intsets"
	"gith
    
func ListNodes(s string, numNodesInCluster int) (Nodes, error) {
	if s == "" {
		return nil, errors.AssertionFailedf("empty node selector")
	}
	if numNodesInCluster < 1 {
		return nil, errors.AssertionFailedf("invalid number of nodes %d", numNodesInCluster)
	}

	if s == "all" {
		return allNodes(numNodesInCluster), nil
	}

	var set intsets.Fast
	for _, p := range strings.Split(s, ",") {
		parts := strings.Split(p, "-")
		switch len(parts) {
		case 1:
			i, err := strconv.Atoi(parts[0])
			if err != nil {
				return nil, errors.Wrapf(err, "unable to parse node selector '%s'", s)
			}
			set.Add(i)

		case 2:
			from, err := strconv.Atoi(parts[0])
			if err != nil {
				return nil, errors.Wrapf(err, "unable to parse node selector '%s'", s)
			}
			to, err := strconv.Atoi(parts[1])
			if err != nil {
				return nil, errors.Wrapf(err, "unable to parse node selector '%s'", s)
			}
			set.AddRange(from, to)

		default:
			return nil, fmt.Errorf("unable to parse node selector '%s'", p)
		}
	}
	nodes := make(Nodes, 0, set.Len())
	set.ForEach(func(v int) {
		nodes = append(nodes, Node(v))
	})
	// Check that the values make sense.
	for _, n := range nodes {
		if n < 1 {
			return nil, fmt.Errorf("invalid node selector '%s', node values start at 1", s)
		}
		if int(n) > numNodesInCluster {
			return nil, fmt.Errorf(
				"invalid node selector '%s', cluster contains %d nodes", s, numNodesInCluster,
			)
		}
	}
	return nodes, nil
}