p.PkgTargetRoot = ctxt.joinPath(p.Root, pkgtargetroot)
// Set the install target if applicable.
- if strings.ToLower(godebug.Get("installgoroot")) == "all" || !p.Goroot {
+ if !p.Goroot || (strings.EqualFold(godebug.Get("installgoroot"), "all") && p.ImportPath != "unsafe" && p.ImportPath != "builtin") {
p.PkgObj = ctxt.joinPath(p.Root, pkga)
}
}
[short] skip
-[!cgo] skip
# Most packages in std do not have an install target.
go list -f '{{.Target}}' fmt
stdout $GOCACHE
# Packages that use cgo still do.
-go list -f '{{.Target}}' runtime/cgo
-stdout .
-go list -export -f '{{.Export}}' runtime/cgo
-! stdout $GOCACHE
-stdout cgo\.a
+[cgo] go list -f '{{.Target}}' runtime/cgo
+[cgo] stdout .
+[cgo] go list -export -f '{{.Export}}' runtime/cgo
+[cgo] ! stdout $GOCACHE
+[cgo] stdout cgo\.a
# With GODEBUG=installgoroot=all, fmt has a target.
# (Though we can't try installing it without modifying goroot).
go list -f '{{.Target}}' fmt
stdout fmt\.a
+# However, the fake packages "builtin" and "unsafe" do not.
+go list -f '{{.Target}}' builtin unsafe
+! stdout .
+go install builtin unsafe # Should succeed as no-ops.
+
# With CGO_ENABLED=0, packages that would have
# an install target with cgo on no longer do.
env GODEBUG=
p.PkgTargetRoot = ctxt.joinPath(p.Root, pkgtargetroot)
// Set the install target if applicable.
- if strings.ToLower(godebug.Get("installgoroot")) == "all" || !p.Goroot {
+ if !p.Goroot || (strings.EqualFold(godebug.Get("installgoroot"), "all") && p.ImportPath != "unsafe" && p.ImportPath != "builtin") {
p.PkgObj = ctxt.joinPath(p.Root, pkga)
}
}