aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist/build.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/dist/build.go')
-rw-r--r--src/cmd/dist/build.go34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index c8c3212d16..158cedbadc 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -111,9 +111,6 @@ func xinit() {
fatalf("$GOROOT must be set")
}
goroot = filepath.Clean(b)
- if modRoot := findModuleRoot(goroot); modRoot != "" {
- fatalf("found go.mod file in %s: $GOROOT must not be inside a module", modRoot)
- }
b = os.Getenv("GOROOT_FINAL")
if b == "" {
@@ -241,6 +238,9 @@ func xinit() {
os.Setenv("LANGUAGE", "en_US.UTF8")
workdir = xworkdir()
+ if err := ioutil.WriteFile(pathf("%s/go.mod", workdir), []byte("module bootstrap"), 0666); err != nil {
+ fatalf("cannot write stub go.mod: %s", err)
+ }
xatexit(rmworkdir)
tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
@@ -982,6 +982,11 @@ func matchtag(tag string) bool {
}
return !matchtag(tag[1:])
}
+ if os.Getenv("GOEXPERIMENT") == "regabi" && tag == "goexperiment.regabi" {
+ // TODO: maybe we can handle GOEXPERIMENT more generally.
+ // Or remove once we commit to regabi (#40724).
+ return true
+ }
return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" ||
(goos == "android" && tag == "linux") ||
(goos == "illumos" && tag == "solaris") ||
@@ -1500,11 +1505,11 @@ func goCmd(goBinary string, cmd string, args ...string) {
goCmd = append(goCmd, "-p=1")
}
- run(goroot, ShowOutput|CheckExit, append(goCmd, args...)...)
+ run(workdir, ShowOutput|CheckExit, append(goCmd, args...)...)
}
func checkNotStale(goBinary string, targets ...string) {
- out := run(goroot, CheckExit,
+ out := run(workdir, CheckExit,
append([]string{
goBinary,
"list", "-gcflags=all=" + gogcflags, "-ldflags=all=" + goldflags,
@@ -1514,7 +1519,7 @@ func checkNotStale(goBinary string, targets ...string) {
os.Setenv("GODEBUG", "gocachehash=1")
for _, target := range []string{"runtime/internal/sys", "cmd/dist", "cmd/link"} {
if strings.Contains(out, "STALE "+target) {
- run(goroot, ShowOutput|CheckExit, goBinary, "list", "-f={{.ImportPath}} {{.Stale}}", target)
+ run(workdir, ShowOutput|CheckExit, goBinary, "list", "-f={{.ImportPath}} {{.Stale}}", target)
break
}
}
@@ -1575,6 +1580,7 @@ var cgoEnabled = map[string]bool{
"windows/386": true,
"windows/amd64": true,
"windows/arm": false,
+ "windows/arm64": false,
}
// List of platforms which are supported but not complete yet. These get
@@ -1609,20 +1615,6 @@ func checkCC() {
}
}
-func findModuleRoot(dir string) (root string) {
- for {
- if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() {
- return dir
- }
- d := filepath.Dir(dir)
- if d == dir {
- break
- }
- dir = d
- }
- return ""
-}
-
func defaulttarg() string {
// xgetwd might return a path with symlinks fully resolved, and if
// there happens to be symlinks in goroot, then the hasprefix test
@@ -1765,6 +1757,8 @@ func IsRuntimePackagePath(pkgpath string) bool {
rval = true
case "syscall":
rval = true
+ case "crypto/x509/internal/macos": // libc function wrappers need to be ABIInternal
+ rval = true
default:
rval = strings.HasPrefix(pkgpath, "runtime/internal")
}