cmd/compile: remove -importmap flag

Obsoleted by -importcfg, and no longer used by anything.

Updates #51225.

Change-Id: I49e646d2728347f862f90805051bb03dd4f4bed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/415235
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Matthew Dempsky 2022-06-29 13:03:51 -07:00
parent f71f3d1b86
commit 1355ea3045
2 changed files with 1 additions and 21 deletions

View file

@ -68,9 +68,6 @@ Flags:
-importcfg file -importcfg file
Read import configuration from file. Read import configuration from file.
In the file, set importmap, packagefile to specify import resolution. In the file, set importmap, packagefile to specify import resolution.
-importmap old=new
Interpret import "old" as import "new" during compilation.
The option may be repeated to add multiple mappings.
-installsuffix suffix -installsuffix suffix
Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix
instead of $GOROOT/pkg/$GOOS_$GOARCH. instead of $GOROOT/pkg/$GOOS_$GOARCH.

View file

@ -100,7 +100,6 @@ type CmdFlags struct {
GenDwarfInl int "help:\"generate DWARF inline info records\"" // 0=disabled, 1=funcs, 2=funcs+formals/locals GenDwarfInl int "help:\"generate DWARF inline info records\"" // 0=disabled, 1=funcs, 2=funcs+formals/locals
GoVersion string "help:\"required version of the runtime\"" GoVersion string "help:\"required version of the runtime\""
ImportCfg func(string) "help:\"read import configuration from `file`\"" ImportCfg func(string) "help:\"read import configuration from `file`\""
ImportMap func(string) "help:\"add `definition` of the form source=actual to import map\""
InstallSuffix string "help:\"set pkg directory `suffix`\"" InstallSuffix string "help:\"set pkg directory `suffix`\""
JSON string "help:\"version,file for JSON compiler/optimizer detail output\"" JSON string "help:\"version,file for JSON compiler/optimizer detail output\""
Lang string "help:\"Go language version source code expects\"" Lang string "help:\"Go language version source code expects\""
@ -130,7 +129,7 @@ type CmdFlags struct {
Files map[string]string Files map[string]string
} }
ImportDirs []string // appended to by -I ImportDirs []string // appended to by -I
ImportMap map[string]string // set by -importmap OR -importcfg ImportMap map[string]string // set by -importcfg
PackageFile map[string]string // set by -importcfg; nil means not in use PackageFile map[string]string // set by -importcfg; nil means not in use
SpectreIndex bool // set by -spectre=index or -spectre=all SpectreIndex bool // set by -spectre=index or -spectre=all
// Whether we are adding any sort of code instrumentation, such as // Whether we are adding any sort of code instrumentation, such as
@ -156,7 +155,6 @@ func ParseFlags() {
Flag.EmbedCfg = readEmbedCfg Flag.EmbedCfg = readEmbedCfg
Flag.GenDwarfInl = 2 Flag.GenDwarfInl = 2
Flag.ImportCfg = readImportCfg Flag.ImportCfg = readImportCfg
Flag.ImportMap = addImportMap
Flag.LinkShared = &Ctxt.Flag_linkshared Flag.LinkShared = &Ctxt.Flag_linkshared
Flag.Shared = &Ctxt.Flag_shared Flag.Shared = &Ctxt.Flag_shared
Flag.WB = true Flag.WB = true
@ -388,21 +386,6 @@ func addImportDir(dir string) {
} }
} }
func addImportMap(s string) {
if Flag.Cfg.ImportMap == nil {
Flag.Cfg.ImportMap = make(map[string]string)
}
if strings.Count(s, "=") != 1 {
log.Fatal("-importmap argument must be of the form source=actual")
}
i := strings.Index(s, "=")
source, actual := s[:i], s[i+1:]
if source == "" || actual == "" {
log.Fatal("-importmap argument must be of the form source=actual; source and actual must be non-empty")
}
Flag.Cfg.ImportMap[source] = actual
}
func readImportCfg(file string) { func readImportCfg(file string) {
if Flag.Cfg.ImportMap == nil { if Flag.Cfg.ImportMap == nil {
Flag.Cfg.ImportMap = make(map[string]string) Flag.Cfg.ImportMap = make(map[string]string)