diff options
author | Bryan Mills <bcmills@google.com> | 2023-03-20 14:31:59 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-03-20 15:39:11 +0000 |
commit | b414ba4c993e38b0c5241f9d36021423afeb05ed (patch) | |
tree | 627046ffdfa7cd11f9a2cb95231efd9f9c5ec409 /src/cmd/go/internal/load/pkg.go | |
parent | 20e9b7f1b53d49fd66e0344b1d0d42d3cf5e47b6 (diff) | |
download | go-b414ba4c993e38b0c5241f9d36021423afeb05ed.tar.gz go-b414ba4c993e38b0c5241f9d36021423afeb05ed.zip |
Revert "cmd/go: import runtime/cgo when externally linking"
This reverts CL 477195.
Reason for revert: test fails on darwin and solaris builders.
Change-Id: I68085f06bc84b0b8649804b8968626ed0e788931
Reviewed-on: https://go-review.googlesource.com/c/go/+/477795
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Bypass: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/go/internal/load/pkg.go')
-rw-r--r-- | src/cmd/go/internal/load/pkg.go | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index 930471b667..dcba2cc28b 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -684,15 +684,6 @@ const ( // GetTestDeps is for download (part of "go get") and indicates // that test dependencies should be fetched too. GetTestDeps - - // The remainder are internal modes for calls to loadImport. - - // cmdlinePkg is for a package mentioned on the command line. - cmdlinePkg - - // cmdlinePkgLiteral is for a package mentioned on the command line - // without using any wildcards or meta-patterns. - cmdlinePkgLiteral ) // LoadImport scans the directory named by path, which must be an import path, @@ -747,30 +738,18 @@ func loadImport(ctx context.Context, opts PackageOpts, pre *preload, path, srcDi return p } - setCmdline := func(p *Package) { - if mode&cmdlinePkg != 0 { - p.Internal.CmdlinePkg = true - } - if mode&cmdlinePkgLiteral != 0 { - p.Internal.CmdlinePkgLiteral = true - } - } - importPath := bp.ImportPath p := packageCache[importPath] if p != nil { stk.Push(path) p = reusePackage(p, stk) stk.Pop() - setCmdline(p) } else { p = new(Package) p.Internal.Local = build.IsLocalImport(path) p.ImportPath = importPath packageCache[importPath] = p - setCmdline(p) - // Load package. // loadPackageData may return bp != nil even if an error occurs, // in order to return partial information. @@ -2865,15 +2844,15 @@ func PackagesAndErrors(ctx context.Context, opts PackageOpts, patterns []string) if pkg == "" { panic(fmt.Sprintf("ImportPaths returned empty package for pattern %s", m.Pattern())) } - mode := cmdlinePkg + p := loadImport(ctx, opts, pre, pkg, base.Cwd(), nil, &stk, nil, 0) + p.Match = append(p.Match, m.Pattern()) + p.Internal.CmdlinePkg = true if m.IsLiteral() { // Note: do not set = m.IsLiteral unconditionally // because maybe we'll see p matching both // a literal and also a non-literal pattern. - mode |= cmdlinePkgLiteral + p.Internal.CmdlinePkgLiteral = true } - p := loadImport(ctx, opts, pre, pkg, base.Cwd(), nil, &stk, nil, mode) - p.Match = append(p.Match, m.Pattern()) if seenPkg[p] { continue } |