Description
Describe the feature or problem you’d like to solve
On Windows every gh process loads user32.dll, and with it win32u, gdi32, gdi32full and imm32, including gh --version and gh api. gh does not use them outside of copying the one-time code during login. They are loaded by github.com/atotto/clipboard v0.1.4 (imported by internal/authflow): its clipboard_windows.go calls syscall.MustLoadDLL("user32") and MustFindProc at package initialization, so the DLL is loaded before main runs.
atotto/clipboard#74 (open) changes these to lazy windows.NewLazySystemDLL lookups.
Measurements: gh 2.103.3 built twice with Go 1.27.3 and the release ldflags, once as is and once with replace github.com/atotto/clipboard => <v0.1.4 + #74>. Windows 11, interleaved runs, median of paired differences with 95% confidence interval, two separate runs:
| images loaded | gh --version |
gh api /user (local test server) |
|
|---|---|---|---|
| as is | 16 | ||
| with #74 | 10 | -4.1 ms (2.7 to 5.4); -7.5 ms (5.4 to 11.4) | -1.6 ms (-1.1 to 4.2); -3.5 ms (0.4 to 5.2) |
The self-built gh matches the release binary. Reading the clipboard still works with the lazy version (checked in a small test program).
Proposed solution
Either bump atotto/clipboard once #74 is released, or point a replace at a fork with #74 until then. This saves a few ms on every gh call on Windows, which adds up for scripts and agents that call gh many times. Happy to open a PR if this gets the help wanted label.
Additional context
gh version 2.103.3 (2026-10-26), Windows 11 x64.
Activity
cli-triage commentedon Nov 6, 2026
The latest release, 2.103.3, and current trunk both still use
github.com/atotto/clipboardv0.1.4, while atotto/clipboard#74 remains open. That means the requested lazy DLL loading is not already available ingh. The report provides a focused Windows use case and measured startup impact acrossgh --versionand an API call. This looks suitable to track as an enhancement. A future change should preserve clipboard behavior during authentication and compare startup results on Windows before and after the dependency change.Supporting reports
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
github-actions commentedon Nov 6, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
jerdcms22-arch commentedon Nov 7, 2026