1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:40:08 -07:00

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 <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Dave Cheney 2016-03-21 14:37:57 +11:00
parent e28a3929ef
commit 39af1eb96f
3 changed files with 3 additions and 8 deletions

View File

@ -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:]
}

View File

@ -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

View File

@ -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()