template/scratch.go
func (s *Scratch) mapSet(k, mk string, v interface{}, o bool) (string, error) {
	if _, ok := s.values[k]; !ok {
		s.values[k] = make(map[string]interface{})
	}

	typed, ok := s.values[k].(map[string]interface{})
	if !ok {
		return "", fmt.Errorf("%q is not a map", k)
	}

	if _, ok := typed[mk]; o || !ok {
		typed[mk] = v
	}
	return "", nil
}
func (s *Scratch) mapSet(k, mk string, v interface{}, o bool) (string, error) {
	if _, ok := s.values[k]; !ok {
		s.values[k] = make(map[string]interface{})
	}

	typed, ok := s.values[k].(map[string]interface{})
	if !ok {
		return "", fmt.Errorf("%q is not a map", k)
	}

	if _, ok := typed[mk]; o || !ok {
		typed[mk] = v
	}
	return "", nil
}
// mapSet is sets the value in the map, overwriting if o is true. This function
// does not perform locking; callers should lock before invoking.