From 6494e4478ba67fe164f9b4a39e8c501952e87a09 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Sat, 14 Feb 2015 07:19:47 -0800 Subject: [PATCH] Rebuild --- examples/spawning-processes/spawning-processes.hash | 4 ++-- examples/url-parsing/url-parsing.hash | 4 ++-- public/spawning-processes | 4 ++-- public/url-parsing | 13 ++++++------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/spawning-processes/spawning-processes.hash b/examples/spawning-processes/spawning-processes.hash index 60e08a2..1cb6249 100644 --- a/examples/spawning-processes/spawning-processes.hash +++ b/examples/spawning-processes/spawning-processes.hash @@ -1,2 +1,2 @@ -4e31686ab1dac4fa0e3ce753a6af207c51b9b049 -utd_H-XJtC +0b676b93e41ac5434003c194bc038d5f3ce76bc8 +y6SB6Mf2VQ diff --git a/examples/url-parsing/url-parsing.hash b/examples/url-parsing/url-parsing.hash index f90f79f..a7fb972 100644 --- a/examples/url-parsing/url-parsing.hash +++ b/examples/url-parsing/url-parsing.hash @@ -1,2 +1,2 @@ -677974cc6b7ba9a63f6c7f2979fd46ef2a4202d7 -eaMv0skOfY +2a74211d0a7bc639c874d7be41e816bf168475d8 +e8HvuLLUw_ diff --git a/public/spawning-processes b/public/spawning-processes index 9048445..a1d6553 100644 --- a/public/spawning-processes +++ b/public/spawning-processes @@ -44,7 +44,7 @@ of spawning processes from Go.

- +
package main
 
@@ -95,7 +95,7 @@ to represent this external process.

-

.Output is another helper than handles the common +

.Output is another helper that handles the common case of running a command, waiting for it to finish, and collecting its output. If there were no errors, dateOut will hold bytes with the date info.

diff --git a/public/url-parsing b/public/url-parsing index da41302..5b68ca1 100644 --- a/public/url-parsing +++ b/public/url-parsing @@ -40,7 +40,7 @@ Here’s how to parse URLs in Go.

- +
package main
 
@@ -54,8 +54,8 @@ Here’s how to parse URLs in Go.

import "fmt"
+import "net"
 import "net/url"
-import "strings"
 
@@ -138,16 +138,15 @@ values.

The Host contains both the hostname and the port, -if present. Split the Host manually to extract -the port.

+if present. Use SplitHostPort to extract them.

    fmt.Println(u.Host)
-    h := strings.Split(u.Host, ":")
-    fmt.Println(h[0])
-    fmt.Println(h[1])
+    host, port, _ := net.SplitHostPort(u.Host)
+    fmt.Println(host)
+    fmt.Println(port)