mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: add -importcfg to specify import resolution
Adds the ability to specify the file location of each imported package, like in the -importcfg added to cmd/compile in a related CL. In effect, -importcfg is a generalization of and supersedes -installsuffix and -L. Of course, those flags will continue to be supported, for compatibility with other tools. Having this flag in Go 1.9 will let us try some experiments involving package management without needing guinea pigs to build a custom Go toolchain. This flag also helps with #14271 at some later point. For #20579. Change-Id: Ie4c171bcd3aa2faa446ac340e36516f2f9853882 Reviewed-on: https://go-review.googlesource.com/44851 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
4d6b08de70
commit
4f2269edbd
4 changed files with 87 additions and 13 deletions
|
|
@ -333,6 +333,19 @@ func errorexit() {
|
|||
}
|
||||
|
||||
func loadinternal(ctxt *Link, name string) *Library {
|
||||
if *FlagLinkshared && ctxt.PackageShlib != nil {
|
||||
if shlibname := ctxt.PackageShlib[name]; shlibname != "" {
|
||||
return addlibpath(ctxt, "internal", "internal", "", name, shlibname)
|
||||
}
|
||||
}
|
||||
if ctxt.PackageFile != nil {
|
||||
if pname := ctxt.PackageFile[name]; pname != "" {
|
||||
return addlibpath(ctxt, "internal", "internal", pname, name, "")
|
||||
}
|
||||
ctxt.Logf("loadinternal: cannot find %s\n", name)
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(ctxt.Libdir); i++ {
|
||||
if *FlagLinkshared {
|
||||
shlibname := filepath.Join(ctxt.Libdir[i], name+".shlibname")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue