func moveLocations(from, to, str string) string {
	matches := locationsRegexp.FindAllStringSubmatchIndex(str, -1)
	buf := new(bytes.Buffer)
	pos := 0
	for _, match := range matches {
		buf.WriteString(str[pos:match[2]])
		label := str[match[2]:match[3]]
		moved := moveLabel(from, to, label)
		buf.WriteString(moved)
		buf.WriteString(str[match[3]:match[1]])
		pos = match[1]
	}
	buf.WriteString(str[pos:])
	return buf.String()
}
func moveLocations(from, to, str string) string {
	matches := locationsRegexp.FindAllStringSubmatchIndex(str, -1)
	buf := new(bytes.Buffer)
	pos := 0
	for _, match := range matches {
		buf.WriteString(str[pos:match[2]])
		label := str[match[2]:match[3]]
		moved := moveLabel(from, to, label)
		buf.WriteString(moved)
		buf.WriteString(str[match[3]:match[1]])
		pos = match[1]
	}
	buf.WriteString(str[pos:])
	return buf.String()
}
func moveLocations ( from , to , str string ) string { matches := locationsRegexp . FindAllStringSubmatchIndex ( str , - 1 ) buf := new ( bytes . Buffer ) pos := 0 for _ , match := range matches { buf . WriteString ( str [ pos : match [ 2 ] ] ) label := str [ match [ 2 ] : match [ 3 ] ] moved := moveLabel ( from , to , label ) buf . WriteString ( moved ) buf . WriteString ( str [ match [ 3 ] : match [ 1 ] ] ) pos = match [ 1 ] } buf . WriteString ( str [ pos : ] ) return buf . String ( ) }
// moveLocations fixes labels within $(location) and $(locations) expansions.
moveLocations fixes labels within $ ( location ) and $ ( locations ) expansions .