| Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 Path : /opt/golang/1.22.0/src/cmd/go/testdata/script/ |
| Current File : //opt/golang/1.22.0/src/cmd/go/testdata/script/work_replace_main_module.txt |
# Ensure that replaces of the main module in workspace modules
# are ignored, and replaces in the go.work file are disallowed.
# This tests against an issue where requirements of the
# main module were being ignored because the main module
# was replaced in a transitive dependency with another
# version.
go list example.com/dep
cp replace_main_module.go.work go.work
! go list example.com/dep
stderr 'go: workspace module example.com/mainmoda is replaced at all versions in the go.work file. To fix, remove the replacement from the go.work file or specify the version at which to replace the module.'
-- replace_main_module.go.work --
go 1.18
use (
./mainmoda
./mainmodb
)
replace example.com/mainmoda => ../mainmodareplacement
-- go.work --
go 1.18
use (
./mainmoda
./mainmodb
)
-- mainmoda/go.mod --
module example.com/mainmoda
go 1.18
require example.com/dep v1.0.0
replace example.com/dep => ../dep
-- dep/go.mod --
module example.com/dep
-- dep/dep.go --
package dep
-- mainmodb/go.mod --
module example.com/mainmodb
go 1.18
replace example.com/mainmoda => ../mainmodareplacement
-- mainmodareplacement/go.mod --
module example.com/mainmoda
go 1.18