github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/cluster/clusterproviders/etcd/utils.go (about)

     1  package etcd
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  func getNodeID(key string, sep string) (string, error) {
     9  	tmpArr := strings.Split(key, sep)
    10  	if len(tmpArr) == 0 {
    11  		return "", fmt.Errorf("invalid key or sep")
    12  	}
    13  	lastIndex := len(tmpArr) - 1
    14  	return tmpArr[lastIndex], nil
    15  }