Skip to content

Commit 28f1ad5

Browse files
rscgopherbot
authored andcommitted
cmd/go: fix TestScript/govcs
On my Mac, TestScript/govcs was failing because hg prints a URL using 1.0.0.127.in-addr.arpa instead of 127.0.0.1, and my Mac cannot resolve that name back into an IP address. % host 127.0.0.1 1.0.0.127.in-addr.arpa domain name pointer localhost. % host 1.0.0.127.in-addr.arpa % Change-Id: Ia0762342d5926d13d786fe66de40590dc8977ff5 Reviewed-on: https://go-review.googlesource.com/c/go/+/718184 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent daa220a commit 28f1ad5

File tree

1 file changed

+7
-0
lines changed
  • src/cmd/go/internal/vcweb

1 file changed

+7
-0
lines changed

src/cmd/go/internal/vcweb/hg.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ func (h *hgHandler) Handler(dir string, env []string, logger *log.Logger) (http.
109109
wg.Done()
110110
}()
111111

112+
// On some systems,
113+
// hg serve --address=localhost --print-url prints in-addr.arpa hostnames
114+
// even though they cannot be looked up.
115+
// Replace them with IP literals.
116+
line = strings.ReplaceAll(line, "//1.0.0.127.in-addr.arpa", "//127.0.0.1")
117+
line = strings.ReplaceAll(line, "//1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa", "//[::1]")
118+
112119
u, err := url.Parse(strings.TrimSpace(line))
113120
if err != nil {
114121
logger.Printf("%v: %v", cmd, err)

0 commit comments

Comments
 (0)