1
0
mirror of https://github.com/golang/go synced 2024-11-11 21:50:21 -07:00

doc/articles/wiki: fix final-test.patch

Fixes test regression introduced by golang.org/cl/53071.

Change-Id: Ibb085cf6d6be7b91b7c90b7bc6237c10f3097703
Reviewed-on: https://go-review.googlesource.com/60775
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2017-08-31 13:24:43 -07:00
parent f316e1a88f
commit e236b6721c

View File

@ -1,36 +1,27 @@
*** final.go 2015-06-14 23:59:22.000000000 +0200
--- final-test.go 2015-06-15 00:15:41.000000000 +0200
***************
*** 7,12 ****
--- 7,14 ----
import (
--- final.go 2017-08-31 13:19:00.422925489 -0700
+++ final-test.go 2017-08-31 13:23:43.381391659 -0700
@@ -8,6 +8,7 @@
"html/template"
"io/ioutil"
+ "log"
"log"
+ "net"
"net/http"
"regexp"
)
***************
*** 85,89 ****
@@ -86,5 +87,15 @@
http.HandleFunc("/edit/", makeHandler(editHandler))
http.HandleFunc("/save/", makeHandler(saveHandler))
! log.Fatal(http.ListenAndServe(":8080", nil))
}
--- 87,101 ----
http.HandleFunc("/edit/", makeHandler(editHandler))
http.HandleFunc("/save/", makeHandler(saveHandler))
! l, err := net.Listen("tcp", "127.0.0.1:0")
! if err != nil {
! log.Fatal(err)
! }
! err = ioutil.WriteFile("final-test-port.txt", []byte(l.Addr().String()), 0644)
! if err != nil {
! log.Fatal(err)
! }
! s := &http.Server{}
! s.Serve(l)
! return
- log.Fatal(http.ListenAndServe(":8080", nil))
+ l, err := net.Listen("tcp", "127.0.0.1:0")
+ if err != nil {
+ log.Fatal(err)
+ }
+ err = ioutil.WriteFile("final-test-port.txt", []byte(l.Addr().String()), 0644)
+ if err != nil {
+ log.Fatal(err)
+ }
+ s := &http.Server{}
+ s.Serve(l)
+ return
}