mirror of
https://github.com/golang/go
synced 2024-11-16 20:14:48 -07:00
cmd/go/internal/load: remove a special case for "unsafe"
We had a special case to zero out the Target field for package "unsafe", which is not imported from a normal object file. As of CL 449376 that special case has been folded into go/build's logic for setting the PkgObj field, so the special case in cmd/go/internal/load has become redundant. (Noticed while investigating CL 449376.) Updates #47257. Updates #56687. Change-Id: I1668123aa6230097aa75e55380d3e2c7937c4b64 Reviewed-on: https://go-review.googlesource.com/c/go/+/449515 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
79d9b395ad
commit
1e11eaa902
@ -1814,6 +1814,9 @@ func (p *Package) load(ctx context.Context, opts PackageOpts, path string, stk *
|
|||||||
// Local import turned into absolute path.
|
// Local import turned into absolute path.
|
||||||
// No permanent install target.
|
// No permanent install target.
|
||||||
p.Target = ""
|
p.Target = ""
|
||||||
|
} else if p.Standard && cfg.BuildContext.Compiler == "gccgo" {
|
||||||
|
// gccgo has a preinstalled standard library that cmd/go cannot rebuild.
|
||||||
|
p.Target = ""
|
||||||
} else {
|
} else {
|
||||||
p.Target = p.Internal.Build.PkgObj
|
p.Target = p.Internal.Build.PkgObj
|
||||||
if cfg.BuildBuildmode == "shared" && p.Internal.Build.PkgTargetRoot != "" {
|
if cfg.BuildBuildmode == "shared" && p.Internal.Build.PkgTargetRoot != "" {
|
||||||
@ -1989,11 +1992,6 @@ func (p *Package) load(ctx context.Context, opts PackageOpts, path string, stk *
|
|||||||
p.setBuildInfo(opts.AutoVCS)
|
p.setBuildInfo(opts.AutoVCS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsafe is a fake package.
|
|
||||||
if p.Standard && (p.ImportPath == "unsafe" || cfg.BuildContext.Compiler == "gccgo") {
|
|
||||||
p.Target = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// If cgo is not enabled, ignore cgo supporting sources
|
// If cgo is not enabled, ignore cgo supporting sources
|
||||||
// just as we ignore go files containing import "C".
|
// just as we ignore go files containing import "C".
|
||||||
if !cfg.BuildContext.CgoEnabled {
|
if !cfg.BuildContext.CgoEnabled {
|
||||||
|
Loading…
Reference in New Issue
Block a user