#!watchflakes
default <- pkg == "golang.org/x/tools/gopls/internal/filewatcher" && test == "TestFileWatcher/broken_symlink_in_darwin"

Issue created automatically to collect these failures.

Example (log):

=== RUN   TestFileWatcher/broken_symlink_in_darwin
    filewatcher_test.go:331: did not capture watch registration failure
--- FAIL: TestFileWatcher/broken_symlink_in_darwin (0.00s)

watchflakes

Comment From: gopherbot

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/gopls/internal/filewatcher" && test == "TestFileWatcher/broken_symlink_in_darwin"
2025-07-28 19:28 x_tools-go1.23-darwin-arm64_13 tools@88d35e46 release-branch.go1.23@e8794e65 x/tools/gopls/internal/filewatcher.TestFileWatcher/broken_symlink_in_darwin (log) === RUN TestFileWatcher/broken_symlink_in_darwin filewatcher_test.go:331: did not capture watch registration failure --- FAIL: TestFileWatcher/broken_symlink_in_darwin (0.00s)

watchflakes

Comment From: h9jiang

This is tricky, I'm kind of expecting the registration to fail at the first time however I did not enforce it in a programmable way. So it's actually possible the watch got registered before the broken symlink get put in place.

I assume this test is flaky not consistent failing.

I start a CL to make this test atomic. Instead of creating a directory and create a broken symlink under it. Prepare the dir and broken symlink somewhere else, and move it to the dir file watcher is watching.

Or another test is mock watcher.Add, allow us to control behavior of this method. This method could return an error the first time without actually calling the watcher.Add, and then call watcher.Add starting from the second attempt. This will make the test available for all OSes.

Comment From: gopherbot

Change https://go.dev/cl/691495 mentions this issue: gopls/internal/filewatcher: atomically move dir to avoid flakiness