Commits

Kelsey Hightower  committed 7096796

Update docs

  • Participants
  • Parent commits df53dc8

Comments (0)

Files changed (1)

File labs/godoc.md

     cd ${GOPATH}/src
     git clone git@github.com:kelseyhightower/pinger.git
 
-## Exercise
-
-### Add package documentation
-
 #### Edit
 
     ${GOPATH}/src/pinger/ping/pinger.go
 		}
 		return &Result{t.url, duration}, nil
 	}
+
+#### Edit
+
+    ${GOPATH}/src/pinger/ping/doc.go 
+
+-
+
+    // Package ping provides Pinger.
+    package ping
+
+#### Edit
+
+    ${GOPATH}/src/pinger/ping/pinger_test.go
+
+-
+
+	package ping
+
+	import (
+		"fmt"
+	)
+
+	func ExampleNewTarget() {
+		t := NewTarget("http://google.com")
+		res, err := t.Ping()
+		if err != nil {
+			fmt.Print(err)
+		}
+		fmt.Print("url: %s duration: %s", t.url, t.duration)
+		// Output: url: http://google.com
+	}
+
+
+#### Run
+
+    godoc -http=":6060"
+
+#### Visit
+
+    http://localhost:6060/pkg