code: func listEnvironWithUpper(upper bool, pairs ...string) Environ {
  	list := append([]string{}, pairs...)
  	if upper {
  		// Uppercase before sorting, so that we can remove duplicates
  		// without the need for linear search nor a map.
  		for i, s := range list {
  			if sep := strings.IndexByte(s, '='); sep > 0 {
  				list[i] = strings.ToUpper(s[:sep]) + s[sep:]
  			}
  		}
  	}
  	sort.Strings(list)
  	last := ""
  	for i := 0; i < len(list); {
  		s := list[i]
  		sep := strings.IndexByte(s, '=')
  		if sep <= 0 {
  			// invalid element; remove it
  			list = append(list[:i], list[i+1:]...)
  			continue
  		}
  		name := s[:sep]
  		if last == name {
  			// duplicate; the last one wins
  			list = append(list[:i-1], list[i:]...)
  			continue
  		}
  		last = name
  		i++
  	}
  	return listEnviron(list)
  }
docs: // listEnvironWithUpper implements ListEnviron, but letting the tests specify
  // whether to uppercase all names or not.