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_get_patch.txt
# This test examines the behavior of 'go get …@patch'
# See also mod_upgrade_patch.txt (focused on "-u=patch" specifically)
# and mod_get_patchmod.txt (focused on module/package ambiguities).

cp go.mod go.mod.orig

# example.net/b@patch refers to the patch for the version of b that was selected
# at the start of 'go get', not the version after applying other changes.

! go get example.net/[email protected] example.net/b@patch
stderr '^go: example.net/[email protected] requires example.net/[email protected], not example.net/b@patch \(v0.1.1\)$'
cmp go.mod go.mod.orig


# -u=patch changes the default version for other arguments to '@patch',
# but they continue to be resolved against the originally-selected version,
# not the updated one.
#
# TODO(#42360): Reconsider the change in defaults.

! go get -u=patch example.net/[email protected] example.net/b
stderr '^go: example.net/[email protected] requires example.net/[email protected], not example.net/b@patch \(v0.1.1\)$'
cmp go.mod go.mod.orig


# -u=patch refers to the patches for the selected versions of dependencies *after*
# applying other version changes, not the versions that were selected at the start.
# However, it should not patch versions determined by explicit arguments.

go get -u=patch example.net/[email protected]
go list -m all
stdout '^example.net/a v0.2.0 '
stdout '^example.net/b v0.2.1 '


# "-u=patch all" should be equivalent to "all@patch", and should fail if the
# patched versions result in a higher-than-patch upgrade.

cp go.mod.orig go.mod
! go get -u=patch all
stderr '^go: example.net/[email protected] \(matching all@patch\) requires example.net/[email protected], not example.net/[email protected] \(matching all@patch\)$'
cmp go.mod go.mod.orig


# On the other hand, "-u=patch ./..." should patch-upgrade dependencies until
# they reach a fixed point, even if that results in higher-than-patch upgrades.

go get -u=patch ./...
go list -m all
stdout '^example.net/a v0.1.1 '
stdout '^example.net/b v0.2.1 '


-- go.mod --
module example

go 1.16

require (
	example.net/a v0.1.0
	example.net/b v0.1.0  // indirect
)

replace (
	example.net/a v0.1.0 => ./a10
	example.net/a v0.1.1 => ./a11
	example.net/a v0.2.0 => ./a20
	example.net/a v0.2.1 => ./a21
	example.net/b v0.1.0 => ./b
	example.net/b v0.1.1 => ./b
	example.net/b v0.2.0 => ./b
	example.net/b v0.2.1 => ./b
	example.net/b v0.3.0 => ./b
	example.net/b v0.3.1 => ./b
)
-- example.go --
package example

import _ "example.net/a"

-- a10/go.mod --
module example.net/a

go 1.16

require example.net/b v0.1.0
-- a10/a.go --
package a

import _ "example.net/b"

-- a11/go.mod --
module example.net/a

go 1.16

require example.net/b v0.2.0  // upgraded
-- a11/a.go --
package a

import _ "example.net/b"

-- a20/go.mod --
module example.net/a

go 1.16

require example.net/b v0.2.0
-- a20/a.go --
package a

import _ "example.net/b"

-- a21/go.mod --
module example.net/a

go 1.16

require example.net/b v0.2.0  // not upgraded
-- a21/a.go --
package a

import _ "example.net/b"

-- b/go.mod --
module example.net/b

go 1.16
-- b/b.go --
package b