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/mod_run_pkg_version.txt
# This test checks the behavior of 'go run' with a 'cmd@version' argument.
# Most of 'go run' is covered in other tests.
# mod_install_pkg_version covers most of the package loading functionality.
# This test focuses on 'go run' behavior specific to this mode.
[short] skip

# 'go run pkg@version' works outside a module.
env GO111MODULE=auto
go run example.com/cmd/[email protected]
stdout '^[email protected]$'


# 'go run pkg@version' reports an error if modules are disabled.
env GO111MODULE=off
! go run example.com/cmd/[email protected]
stderr '^go: modules disabled by GO111MODULE=off; see ''go help modules''$'
env GO111MODULE=on


# 'go run pkg@version' ignores go.mod in the current directory.
cd m
cp go.mod go.mod.orig
! go list -m all
stderr '^go: example.com/[email protected]: reading http.*/mod/example\.com/cmd/@v/v1.1.0-doesnotexist.info: 404 Not Found\n\tserver response: 404 page not found$'
stderr '^go: example.com/[email protected]: missing go.sum entry for go.mod file; to add it:\n\tgo mod download example.com/cmd$'
go run example.com/cmd/[email protected]
stdout '^[email protected]$'
cmp go.mod go.mod.orig
cd ..


# 'go install pkg@version' works on a module that doesn't have a go.mod file
# and with a module whose go.mod file has missing requirements.
# With a proxy, the two cases are indistinguishable.
go run rsc.io/[email protected]
stderr '^go: found rsc.io/quote in rsc.io/quote v1.5.2$'
stderr '^Hello, world.$'


# 'go run pkg@version' should report an error if pkg is not a main package.
! go run example.com/cmd/[email protected]
stderr '^package example.com/cmd/err is not a main package$'


# 'go run pkg@version' should report errors if the module contains
# replace or exclude directives.
go mod download example.com/[email protected]
! go run example.com/cmd/[email protected]
cmp stderr replace-err

go mod download example.com/[email protected]
! go run example.com/cmd/[email protected]
cmp stderr exclude-err


# 'go run dir@version' works like a normal 'go run' command if
# dir is a relative or absolute path.
go mod download rsc.io/[email protected]
! go run $GOPATH/pkg/mod/rsc.io/[email protected]
stderr '^go: go\.mod file not found in current directory or any parent directory; see ''go help modules''$'
! go run ../pkg/mod/rsc.io/[email protected]
stderr '^go: go\.mod file not found in current directory or any parent directory; see ''go help modules''$'
mkdir tmp
cd tmp
go mod init tmp
go mod edit -require=rsc.io/[email protected]
! go run -mod=readonly $GOPATH/pkg/mod/rsc.io/[email protected]
stderr '^missing go\.sum entry for module providing package rsc\.io/fortune; to add:\n\tgo mod download rsc\.io/fortune$'
! go run -mod=readonly ../../pkg/mod/rsc.io/[email protected]
stderr '^missing go\.sum entry for module providing package rsc\.io/fortune; to add:\n\tgo mod download rsc\.io/fortune$'
cd ..
rm tmp


# 'go run' does not interpret @version arguments after the first.
go run example.com/cmd/[email protected] example.com/[email protected]
stdout '^[email protected]$'


# 'go run pkg@version' succeeds when -mod=readonly is set explicitly.
# Verifies #43278.
go run -mod=readonly example.com/cmd/[email protected]
stdout '^[email protected]$'

-- m/go.mod --
module m

go 1.16

require example.com/cmd v1.1.0-doesnotexist
-- x/x.go --
package main

func main() {}
-- replace-err --
go: example.com/cmd/[email protected] (in example.com/[email protected]):
	The go.mod file for the module providing named packages contains one or
	more replace directives. It must not contain directives that would cause
	it to be interpreted differently than if it were the main module.
-- exclude-err --
go: example.com/cmd/[email protected] (in example.com/[email protected]):
	The go.mod file for the module providing named packages contains one or
	more exclude directives. It must not contain directives that would cause
	it to be interpreted differently than if it were the main module.