Commit 39af1eb9 authored by Dave Cheney's avatar Dave Cheney

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: default avatarIan Lance Taylor <iant@golang.org>
parent e28a3929
...@@ -16,6 +16,7 @@ import ( ...@@ -16,6 +16,7 @@ import (
"log" "log"
"os" "os"
"path" "path"
"runtime"
"strconv" "strconv"
"strings" "strings"
) )
...@@ -571,7 +572,7 @@ func isDriveLetter(b byte) bool { ...@@ -571,7 +572,7 @@ func isDriveLetter(b byte) bool {
// is this path a local name? begins with ./ or ../ or / // is this path a local name? begins with ./ or ../ or /
func islocalname(name string) bool { func islocalname(name string) bool {
return strings.HasPrefix(name, "/") || 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 == "." ||
strings.HasPrefix(name, "../") || name == ".." strings.HasPrefix(name, "../") || name == ".."
} }
...@@ -893,7 +894,7 @@ func mkpackage(pkgname string) { ...@@ -893,7 +894,7 @@ func mkpackage(pkgname string) {
if i := strings.LastIndex(p, "/"); i >= 0 { if i := strings.LastIndex(p, "/"); i >= 0 {
p = p[i+1:] p = p[i+1:]
} }
if Ctxt.Windows != 0 { if runtime.GOOS == "windows" {
if i := strings.LastIndex(p, `\`); i >= 0 { if i := strings.LastIndex(p, `\`); i >= 0 {
p = p[i+1:] p = p[i+1:]
} }
......
...@@ -618,7 +618,6 @@ type Link struct { ...@@ -618,7 +618,6 @@ type Link struct {
Flag_optimize bool Flag_optimize bool
Bso *Biobuf Bso *Biobuf
Pathname string Pathname string
Windows int32
Goroot string Goroot string
Goroot_final string Goroot_final string
Hash map[SymVer]*LSym Hash map[SymVer]*LSym
......
...@@ -35,7 +35,6 @@ import ( ...@@ -35,7 +35,6 @@ import (
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strconv" "strconv"
) )
...@@ -83,10 +82,6 @@ func Linknew(arch *LinkArch) *Link { ...@@ -83,10 +82,6 @@ func Linknew(arch *LinkArch) *Link {
ctxt.Version = HistVersion ctxt.Version = HistVersion
ctxt.Goroot = Getgoroot() ctxt.Goroot = Getgoroot()
ctxt.Goroot_final = os.Getenv("GOROOT_FINAL") 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 var buf string
buf, _ = os.Getwd() buf, _ = os.Getwd()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment