From 1355ea3045cd1327740ecfb7387918db45bf4f89 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 29 Jun 2022 13:03:51 -0700 Subject: [PATCH] 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 Run-TryBot: Matthew Dempsky TryBot-Result: Gopher Robot Reviewed-by: David Chase --- src/cmd/compile/doc.go | 3 --- src/cmd/compile/internal/base/flag.go | 19 +------------------ 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/cmd/compile/doc.go b/src/cmd/compile/doc.go index b8862f62cf..60e12630c5 100644 --- a/src/cmd/compile/doc.go +++ b/src/cmd/compile/doc.go @@ -68,9 +68,6 @@ Flags: -importcfg file Read import configuration from file. 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 Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix instead of $GOROOT/pkg/$GOOS_$GOARCH. diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go index 4de0df21cb..a363b83984 100644 --- a/src/cmd/compile/internal/base/flag.go +++ b/src/cmd/compile/internal/base/flag.go @@ -100,7 +100,6 @@ type CmdFlags struct { GenDwarfInl int "help:\"generate DWARF inline info records\"" // 0=disabled, 1=funcs, 2=funcs+formals/locals GoVersion string "help:\"required version of the runtime\"" 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`\"" JSON string "help:\"version,file for JSON compiler/optimizer detail output\"" Lang string "help:\"Go language version source code expects\"" @@ -130,7 +129,7 @@ type CmdFlags struct { Files map[string]string } 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 SpectreIndex bool // set by -spectre=index or -spectre=all // Whether we are adding any sort of code instrumentation, such as @@ -156,7 +155,6 @@ func ParseFlags() { Flag.EmbedCfg = readEmbedCfg Flag.GenDwarfInl = 2 Flag.ImportCfg = readImportCfg - Flag.ImportMap = addImportMap Flag.LinkShared = &Ctxt.Flag_linkshared Flag.Shared = &Ctxt.Flag_shared 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) { if Flag.Cfg.ImportMap == nil { Flag.Cfg.ImportMap = make(map[string]string)