blob: d9d9d9889741cdf58ef3c1c771a9cae60beb6583 [file] [log] [blame]
# Check that when -trimpath and -mod=vendor are used together,
# paths in vendored packages are properly trimmed.
# Verifies
[short] skip
# Only the main module has a root directory in vendor mode.
go mod vendor
go list -f {{.Module.Dir}}
stdout $PWD
go list -f {{.Module.Dir}}
! 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 '^$'
# 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 '^$'
-- go.mod --
go 1.17
require v1.0.0
-- go.sum -- v1.0.0 h1:IEDLeew5NytZ8vrgCF/QVem3H3SR3QMttdu9HfJvk9I= v1.0.0/go.mod h1:7wFEbaV5e5O7wJ8aBdqQOR//UXppm/pwnwziMKViuI4=
-- main.go --
package main
import (
func main() {