template/scratch.go
func (s *Scratch) MapValues(k string) ([]interface{}, error) {
	s.init()

	s.Lock()
	defer s.Unlock()
	if s.values == nil {
		return nil, nil
	}

	typed, ok := s.values[k].(map[string]interface{})
	if !ok {
		return nil, nil
	}

	keys := make([]string, 0, len(typed))
	for k := range typed {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	sorted := make([]interface{}, len(keys))
	for i, k := range keys {
		sorted[i] = typed[k]
	}
	return sorted, nil
}
func (s *Scratch) MapValues(k string) ([]interface{}, error) {
	s.init()

	s.Lock()
	defer s.Unlock()
	if s.values == nil {
		return nil, nil
	}

	typed, ok := s.values[k].(map[string]interface{})
	if !ok {
		return nil, nil
	}

	keys := make([]string, 0, len(typed))
	for k := range typed {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	sorted := make([]interface{}, len(keys))
	for i, k := range keys {
		sorted[i] = typed[k]
	}
	return sorted, nil
}
// MapValues returns the list of values in the map sorted by key.