ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/golang/1.22.0/src/cmd/go/testdata/script/dist_list_missing.txt
# Regression test for #60939: when 'go tool dist' is missing,
# 'go tool dist list' should inject its output.


# Set GOROOT to a directory that definitely does not include
# a compiled 'dist' tool. 'go tool dist list' should still
# work, because 'cmd/go' itself can impersonate this command.

mkdir $WORK/goroot/bin
mkdir $WORK/goroot/pkg/tool/${GOOS}_${GOARCH}
env GOROOT=$WORK/goroot

! go tool -n dist
stderr 'go: no such tool "dist"'

go tool dist list
stdout linux/amd64
cp stdout tool.txt

go tool dist list -v
stdout linux/amd64
cp stdout tool-v.txt

go tool dist list -broken
stdout $GOOS/$GOARCH
cp stdout tool-broken.txt

go tool dist list -json
stdout '"GOOS": "linux",\n\s*"GOARCH": "amd64",\n'
cp stdout tool-json.txt

go tool dist list -json -broken
stdout '"GOOS": "'$GOOS'",\n\s*"GOARCH": "'$GOARCH'",\n'
cp stdout tool-json-broken.txt

[short] stop


# Check against the real cmd/dist as the source of truth.

env GOROOT=$TESTGO_GOROOT
go build -o dist.exe cmd/dist

exec ./dist.exe list
cmp stdout tool.txt

exec ./dist.exe list -v
cmp stdout tool-v.txt

exec ./dist.exe list -broken
cmp stdout tool-broken.txt

exec ./dist.exe list -json
cmp stdout tool-json.txt

exec ./dist.exe list -json -broken
cmp stdout tool-json-broken.txt