Skip to content

Remove deprecated reading of env vars for determining diff program#1469

Open
Ahajha wants to merge 2 commits into
bazelbuild:mainfrom
Ahajha:trotta/remove-deprecated
Open

Remove deprecated reading of env vars for determining diff program#1469
Ahajha wants to merge 2 commits into
bazelbuild:mainfrom
Ahajha:trotta/remove-deprecated

Conversation

@Ahajha

@Ahajha Ahajha commented Jun 2, 2026

Copy link
Copy Markdown

My environment for whatever reason has DISPLAY=1, and so in diff mode I always get this warning. A whole bunch of this has been deprecated since 2019, just delete it so I can silence it.

My environment for whatever reason has `DISPLAY=1`, and so in diff mode I always get this warning. A whole bunch of this has been deprecated since 2019, just delete it so I can silence it.
@Ahajha Ahajha requested a review from a team as a code owner June 2, 2026 05:09
@Ahajha Ahajha requested review from oreflow and removed request for a team June 2, 2026 05:09

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the diff command selection by removing deprecated environment variables and setting the default diff command to 'diff --unified'. However, removing the Windows fallback to 'FC' will break diffing on Windows systems without bash and diff installed, so this fallback should be restored. Additionally, the documentation comment for the Find function is now outdated and should be updated, and the parentheses around its single return type should be removed to adhere to idiomatic Go formatting.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread differ/diff.go
d.MultiDiff = md == "1"
knowMultiDiff = true
}
d.Cmd = "diff --unified"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Removing the Windows fallback to FC will break buildifier -mode=diff on Windows environments that do not have bash and diff installed.

When d.Cmd is set to "diff --unified", the Differ.run method attempts to execute it via /usr/bin/env bash, which is not available on standard Windows systems. Keeping the FC fallback for Windows ensures that diffing continues to work out-of-the-box on Windows.

Note: You will also need to add "runtime" back to the imports list at the top of this file.

	if runtime.GOOS == "windows" {
		d.Cmd = "FC"
	} else {
		d.Cmd = "diff --unified"
	}
References
  1. When modifying code, ensure that changes are consistent with previous behavior, especially if the previous behavior was intentional.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure about this one. #520 marked this path as deprecated too, but I'm wondering the reason for making the sole Windows path here deprecated.

Comment thread differ/diff.go Outdated
Comment thread differ/diff.go Outdated
@Ahajha

Ahajha commented Jun 8, 2026

Copy link
Copy Markdown
Author

@vladmos Could you please TAL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant