From: Dave Cheney Date: Mon, 21 Mar 2016 03:37:57 +0000 (+1100) Subject: cmd/internal/obj: remove Link.Windows field X-Git-Tag: go1.7beta1~1198 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=39af1eb96f37edc96e2bde24fdd877e49223f751;p=gostls13.git cmd/internal/obj: remove Link.Windows field This CL addresses a long standing CL by rsc by pushing the use of Link.Windows down to its two users. Link.Window was always initalised with the value of runtime.GOOS so this does not affect cross compilation. Change-Id: Ibbae068f8b5aad06336909691f094384caf12352 Reviewed-on: https://go-review.googlesource.com/20869 Run-TryBot: Dave Cheney TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index b29f7d10ae..e7011646c3 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -16,6 +16,7 @@ import ( "log" "os" "path" + "runtime" "strconv" "strings" ) @@ -571,7 +572,7 @@ func isDriveLetter(b byte) bool { // is this path a local name? begins with ./ or ../ or / func islocalname(name string) bool { return strings.HasPrefix(name, "/") || - Ctxt.Windows != 0 && len(name) >= 3 && isDriveLetter(name[0]) && name[1] == ':' && name[2] == '/' || + runtime.GOOS == "windows" && len(name) >= 3 && isDriveLetter(name[0]) && name[1] == ':' && name[2] == '/' || strings.HasPrefix(name, "./") || name == "." || strings.HasPrefix(name, "../") || name == ".." } @@ -893,7 +894,7 @@ func mkpackage(pkgname string) { if i := strings.LastIndex(p, "/"); i >= 0 { p = p[i+1:] } - if Ctxt.Windows != 0 { + if runtime.GOOS == "windows" { if i := strings.LastIndex(p, `\`); i >= 0 { p = p[i+1:] } diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index 8cae1255cd..e2993630a9 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -618,7 +618,6 @@ type Link struct { Flag_optimize bool Bso *Biobuf Pathname string - Windows int32 Goroot string Goroot_final string Hash map[SymVer]*LSym diff --git a/src/cmd/internal/obj/sym.go b/src/cmd/internal/obj/sym.go index 41623266f5..a723eb4689 100644 --- a/src/cmd/internal/obj/sym.go +++ b/src/cmd/internal/obj/sym.go @@ -35,7 +35,6 @@ import ( "log" "os" "path/filepath" - "runtime" "strconv" ) @@ -83,10 +82,6 @@ func Linknew(arch *LinkArch) *Link { ctxt.Version = HistVersion ctxt.Goroot = Getgoroot() ctxt.Goroot_final = os.Getenv("GOROOT_FINAL") - if runtime.GOOS == "windows" { - // TODO(rsc): Remove ctxt.Windows and let callers use runtime.GOOS. - ctxt.Windows = 1 - } var buf string buf, _ = os.Getwd()