mirror of
https://github.com/tailscale/tailscale.git
synced 2026-04-21 21:42:19 +02:00
go.cmd used cmd.exe to invoke PowerShell, which mangled arguments: cmd.exe treats ^ as an escape character (so -run "^$" became -run "$", running all tests instead of none) and = signs also caused issues in the PowerShell→cmd.exe argument passing layer. Replace it with a tiny no_std Rust binary (19KB, 32-bit x86 for universal Windows compat: x86/x64/ARM64) that directly invokes the Tailscale Go toolchain via CreateProcessW. The raw command line from GetCommandLineW is passed through to CreateProcessW with only argv[0] replaced, so arguments are never parsed or re-escaped. The binary also handles first-run toolchain download natively using curl.exe and tar.exe (both ship with Windows 10+), so PowerShell is no longer required for normal operation. The PowerShell fallback is only used for the rare TS_USE_GOCROSS=1 path. PowerShell prefers go.exe over go.cmd when resolving ./tool/go, so this is a drop-in replacement. With go.exe in place, the CI can use the natural -bench=. -benchtime=1x -run="^$" flags directly. Also removes tool/go-win.ps1 which is now unused. Updates #19255 Change-Id: I80da23285b74796e7694b89cff29a9fa0eaa6281 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
29 lines
816 B
Makefile
29 lines
816 B
Makefile
# Builds tool/go.exe, a thin wrapper that execs the Tailscale Go
|
|
# toolchain without going through cmd.exe (which mangles ^ and other
|
|
# special characters in arguments).
|
|
# See https://github.com/tailscale/tailscale/issues/19255
|
|
#
|
|
# Built as no_std Rust with raw Win32 API calls for minimal size (~17KB).
|
|
# The resulting go.exe is checked into the repo at tool/go.exe.
|
|
#
|
|
# Built as 32-bit x86 so one binary runs on x86, x64 (via WoW64),
|
|
# and ARM64 (via Windows x86 emulation).
|
|
#
|
|
# Requirements:
|
|
# rustup target add i686-pc-windows-gnu
|
|
# apt install gcc-mingw-w64-i686 (or equivalent)
|
|
|
|
RUST_TARGET = i686-pc-windows-gnu
|
|
|
|
.PHONY: all clean
|
|
|
|
all: go.exe
|
|
|
|
go.exe: src/main.rs Cargo.toml
|
|
cargo build --release --target $(RUST_TARGET)
|
|
cp target/$(RUST_TARGET)/release/go.exe $@
|
|
|
|
clean:
|
|
rm -f go.exe
|
|
rm -rf target
|