Server : LiteSpeed System : Linux in-mum-web1333.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u141265441 ( 141265441) PHP Version : 8.4.3 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail Directory : /proc/self/root/opt/golang/1.22.0/src/cmd/go/testdata/script/ |
# Check that when -trimpath and -mod=vendor are used together,
# paths in vendored packages are properly trimmed.
# Verifies golang.org/issue/36566.
[short] skip
# Only the main module has a root directory in vendor mode.
go mod vendor
go list -f {{.Module.Dir}} example.com/main
stdout $PWD
go list -f {{.Module.Dir}} example.com/stack
! stdout .
# The program prints a file name from a vendored package.
# Without -trimpath, the name should include the vendor directory.
go run main.go
stdout vendor
# With -trimpath, everything before the package path should be trimmed.
# As with -mod=mod, the version should appear as part of the module path.
go run -mod=vendor -trimpath main.go
stdout '^example.com/stack@v1.0.0/stack.go$'
# With pristinely vendored source code, a trimmed binary built from vendored
# code should have the same behavior as one build from the module cache.
go run -mod=mod -trimpath main.go
stdout '^example.com/stack@v1.0.0/stack.go$'
-- go.mod --
module example.com/main
go 1.17
require example.com/stack v1.0.0
-- go.sum --
example.com/stack v1.0.0 h1:IEDLeew5NytZ8vrgCF/QVem3H3SR3QMttdu9HfJvk9I=
example.com/stack v1.0.0/go.mod h1:7wFEbaV5e5O7wJ8aBdqQOR//UXppm/pwnwziMKViuI4=
-- main.go --
package main
import (
"fmt"
"example.com/stack"
)
func main() {
fmt.Println(stack.TopFile())
}