]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/modload: remove printStackInDie functionality
authorJay Conrod <jayconrod@google.com>
Mon, 19 Oct 2020 18:02:14 +0000 (14:02 -0400)
committerJay Conrod <jayconrod@google.com>
Tue, 20 Oct 2020 18:46:31 +0000 (18:46 +0000)
Previously, when running cmd/go tests, if the module root directory is
requested when modules are explicitly disabled, we printed a stack
trace in addition to the error message that's normally printed. The
stack trace isn't that useful, and it makes the actual error hard to
find.

Change-Id: I8230d668f3f16659f08d0d685124c41b4055c5b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/263659
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/modload/build.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/testgo.go [deleted file]

index f49b52df5666aeeab1c06a1b431ffb1015af59ed..b9abb0b93c10829fb9c9a42045b189d1b5b055ca 100644 (file)
@@ -13,7 +13,6 @@ import (
        "internal/goroot"
        "os"
        "path/filepath"
-       "runtime/debug"
        "strings"
 
        "cmd/go/internal/base"
@@ -312,9 +311,6 @@ func mustFindModule(target, path string) module.Version {
                return Target
        }
 
-       if printStackInDie {
-               debug.PrintStack()
-       }
        base.Fatalf("build %v: cannot find module for path %v", target, path)
        panic("unreachable")
 }
index e1b784860b8c189d9eed7fb874d5c793eb4d1c3b..1fcc53735c45ef463ed518a841b3b18fcd74e7d8 100644 (file)
@@ -16,7 +16,6 @@ import (
        "os"
        "path"
        "path/filepath"
-       "runtime/debug"
        "strconv"
        "strings"
 
@@ -330,16 +329,7 @@ func ModFilePath() string {
        return filepath.Join(modRoot, "go.mod")
 }
 
-// printStackInDie causes die to print a stack trace.
-//
-// It is enabled by the testgo tag, and helps to diagnose paths that
-// unexpectedly require a main module.
-var printStackInDie = false
-
 func die() {
-       if printStackInDie {
-               debug.PrintStack()
-       }
        if cfg.Getenv("GO111MODULE") == "off" {
                base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'")
        }
diff --git a/src/cmd/go/internal/modload/testgo.go b/src/cmd/go/internal/modload/testgo.go
deleted file mode 100644 (file)
index 6b34f5b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build testgo
-
-package modload
-
-func init() {
-       printStackInDie = true
-}