Skip to content

Commit b49b775

Browse files
committed
localhost hack for macOS 10.12.5
See bazelbuild#150 and golang/go#20904
1 parent a6dbcd2 commit b49b775

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

go/httphelper/http_helper.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ import (
2121
"crypto/tls"
2222
"fmt"
2323
"io"
24-
"net"
2524
"net/http"
2625
"net/url"
27-
"os"
28-
"sort"
2926
"strings"
3027
)
3128

@@ -136,29 +133,5 @@ func (s longestToShortest) Less(i, j int) bool {
136133
// FQDN returns the fully-qualified domain name (or localhost if lookup
137134
// according to the hostname fails).
138135
func FQDN() (string, error) {
139-
hostname, err := os.Hostname()
140-
if err != nil {
141-
// Fail if the kernel fails to report a hostname.
142-
return "", err
143-
}
144-
145-
addrs, err := net.LookupHost(hostname)
146-
if err != nil {
147-
return "localhost", nil
148-
}
149-
150-
for _, addr := range addrs {
151-
if names, err := net.LookupAddr(addr); err == nil && len(names) > 0 {
152-
sort.Sort(longestToShortest(names))
153-
for _, name := range names {
154-
name = strings.TrimRight(name, ".")
155-
if strings.HasPrefix(name, hostname) {
156-
return name, nil
157-
}
158-
}
159-
return names[0], nil
160-
}
161-
}
162-
163136
return "localhost", nil
164137
}

0 commit comments

Comments
 (0)