code: func TempDir(dir string, prefix string, mode os.FileMode) (name string, err error) {
  	for i := 0; i < 1000; i++ {
  		try := filepath.Join(dir, prefix+pseudoRand())
  		err = os.Mkdir(try, mode)
  		if os.IsExist(err) {
  			continue
  		}
  		if err == nil {
  			name = try
  		}
  		break
  	}
  	return
  }
docs: // TempDir is like ioutil.TempDir(dir, ""), but uses shorter path suffixes.
  //
  // Path length is constraint resource of Windows.
  //
  // Supposed to be used only in cases when the probability of a conflict is low
  // (e.g. when 'dir' is some "private" directory, not global /tmp or something
  // like that).
  //
  // Additionally, this allows you to pass mode (which will respect the process
  // umask). To get ioutils.TempDir behavior, pass 0700 for the mode.