diff options
Diffstat (limited to 'src/cmd/go/testdata/script/mod_outside.txt')
-rw-r--r-- | src/cmd/go/testdata/script/mod_outside.txt | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt index e398f7bc40..d969fce145 100644 --- a/src/cmd/go/testdata/script/mod_outside.txt +++ b/src/cmd/go/testdata/script/mod_outside.txt @@ -39,6 +39,11 @@ stdout '^fmt$' go list ./needmod/needmod.go stdout 'command-line-arguments' +# 'go list' on a package from a module should fail. +! go list example.com/printversion +stderr '^no required module provides package example.com/printversion: working directory is not part of a module$' + + # 'go list -m' with an explicit version should resolve that version. go list -m example.com/version@latest stdout 'example.com/version v1.1.0' @@ -151,7 +156,7 @@ stderr 'cannot find main module' # 'go build' of source files should fail if they import anything outside std. ! go build -n ./needmod/needmod.go -stderr 'needmod[/\\]needmod.go:10:2: cannot find module providing package example.com/version: working directory is not part of a module' +stderr '^needmod[/\\]needmod.go:10:2: no required module provides package example.com/version: working directory is not part of a module$' # 'go build' of source files should succeed if they do not import anything outside std. go build -n -o ignore ./stdonly/stdonly.go @@ -174,7 +179,7 @@ go doc fmt # 'go doc' should fail for a package path outside a module. ! go doc example.com/version -stderr 'doc: cannot find module providing package example.com/version: working directory is not part of a module' +stderr 'doc: no required module provides package example.com/version: working directory is not part of a module' # 'go install' with a version should succeed if all constraints are met. # See mod_install_pkg_version. @@ -184,12 +189,12 @@ exists $GOPATH/bin/printversion$GOEXE # 'go install' should fail if a package argument must be resolved to a module. ! go install example.com/printversion -stderr 'cannot find module providing package example.com/printversion: working directory is not part of a module' +stderr 'no required module provides package example.com/printversion: working directory is not part of a module' # 'go install' should fail if a source file imports a package that must be # resolved to a module. ! go install ./needmod/needmod.go -stderr 'needmod[/\\]needmod.go:10:2: cannot find module providing package example.com/version: working directory is not part of a module' +stderr 'needmod[/\\]needmod.go:10:2: no required module provides package example.com/version: working directory is not part of a module' # 'go run' with a verison should fail due to syntax. @@ -198,12 +203,12 @@ stderr 'can only use path@version syntax with' # 'go run' should fail if a package argument must be resolved to a module. ! go run example.com/printversion -stderr 'cannot find module providing package example.com/printversion: working directory is not part of a module' +stderr '^no required module provides package example.com/printversion: working directory is not part of a module$' # 'go run' should fail if a source file imports a package that must be # resolved to a module. ! go run ./needmod/needmod.go -stderr 'needmod[/\\]needmod.go:10:2: cannot find module providing package example.com/version: working directory is not part of a module' +stderr '^needmod[/\\]needmod.go:10:2: no required module provides package example.com/version: working directory is not part of a module$' # 'go fmt' should be able to format files outside of a module. @@ -221,7 +226,7 @@ stdout 'main is example.com/printversion v0.1.0' stdout 'using example.com/version v1.1.0' # 'go get' of a versioned binary should build and install the latest version -# using its minimal module requirements, ignoring replacements and exclusions. +# using its minimal required modules, ignoring replacements and exclusions. go get example.com/printversion exec ../bin/printversion stdout 'path is example.com/printversion' |