func Parse(raw string) (*PathExp, error) {
	parts := strings.Split(raw, "/")

	if len(parts) != 7 {
		return nil, errors.New("Wrong number of path segements.")
	}

	if parts[0] != "" {
		return nil, errors.New("Path expressions must start with '/'.")
	}
	// remove leading empty section
	parts = parts[1:]

	splitParts := make([][]string, 6)
	splitNames := []string{"", "", "environment", "service", "identity", "instance"}
	var err error
	for i := 2; i < len(splitParts); i++ {
		splitParts[i], err = Split(splitNames[i], parts[i])
		if err != nil {
			return nil, err
		}
	}

	return New(parts[orgIdx], parts[projectIdx],
		splitParts[envIdx],
		splitParts[serviceIdx],
		splitParts[identityIdx],
		splitParts[instanceIdx],
	)
}
// Parse parses a string into a path expression. It returns an error if the
// string is not a valid path expression.
Parse parses a string into a path expression. It returns an error if the
string is not a valid path expression.
// Parse parses a string into a path expression . It returns an error if the // string is not a valid path expression .
func Parse(raw string) (*PathExp, error) {
	parts := strings.Split(raw, "/")
	if len(parts) != 7 {
		return nil, errors.New("Wrong number of path segements.")
	}
	if parts[0] != "" {
		return nil, errors.New("Path expressions must start with '/'.")
	}
	parts = parts[1:]
	splitParts := make([][]string, 6)
	splitNames := []string{"", "", "environment", "service", "identity", "instance"}
	var err error
	for i := 2; i < len(splitParts); i++ {
		splitParts[i], err = Split(splitNames[i], parts[i])
		if err != nil {
			return nil, err
		}
	}
	return New(parts[orgIdx], parts[projectIdx],
		splitParts[envIdx],
		splitParts[serviceIdx],
		splitParts[identityIdx],
		splitParts[instanceIdx],
	)
}
func Parse ( raw string ) ( * PathExp , error ) { parts := strings . Split ( raw , " " ) if len ( parts ) != 7 { return nil , errors . New ( " " ) } if parts [ 0 ] != " " { return nil , errors . New ( " " ) } parts = parts [ 1 : ] splitParts := make ( [ ] [ ] string , 6 ) splitNames := [ ] string { " " , " " , " " , " " , " " , " " } var err error for i := 2 ; i < len ( splitParts ) ; i ++ { splitParts [ i ] , err = Split ( splitNames [ i ] , parts [ i ] ) if err != nil { return nil , err } } return New ( parts [ orgIdx ] , parts [ projectIdx ] , splitParts [ envIdx ] , splitParts [ serviceIdx ] , splitParts [ identityIdx ] , splitParts [ instanceIdx ] , ) }
Parse parses a string into a path expression.
Parse parses a string into a path expression .
// remove leading empty section