I used the following configuration for the esbuild benchmark:

# config.toml
[[config]]
  name = "myconfig"
  goroot = "/home/yukatan/golang"

Then run:

$ ./sweet run -run esbuild -shell -work-dir `pwd`/tmp config.toml

It worked file. However, when I tried to run this again, I got the following error:

[sweet] Work directory: /home/yukatan/benchmarks/sweet/tmp
[sweet] Benchmarks: esbuild (10 runs)
[sweet] Setting up benchmark: esbuild
[shell] mkdir -p /home/yukatan/benchmarks/sweet/results/esbuild
[shell] mkdir -p /home/yukatan/benchmarks/sweet/tmp/esbuild/myconfig/bin
[shell] mkdir -p /home/yukatan/benchmarks/sweet/tmp/esbuild/src
[shell] mkdir -p /home/yukatan/benchmarks/sweet/tmp/esbuild/myconfig/tmp
[shell] ln -s /home/yukatan/benchmarks/sweet/tmp/esbuild/src /home/yukatan/benchmarks/sweet/tmp/esbuild/myconfig/bin/esbuild-src
[sweet] error: build esbuild for myconfig: symlink /home/yukatan/benchmarks/sweet/tmp/esbuild/src /home/yukatan/benchmarks/sweet/tmp/esbuild/myconfig/bin/esbuild-src: file exists

The symlink() function (harnesses/common.go) causes this error. It calls os.Symlink -> symlinkat but this syscall returns the error if the destination file exists. Unlike ln -s, symlink() doesn't handle this case.

Comment From: gopherbot

Change https://go.dev/cl/680816 mentions this issue: sweet/harnesses: remove existing symlink before calling os.Symlink