Merge pull request #676 from heyalexej/patch-1

fix import of io/ioutil, run gofmt
This commit is contained in:
Levi Bostian 2014-07-16 11:07:42 -05:00
commit 57c384420e

View File

@ -9,6 +9,7 @@ contributors:
- ["Jesse Johnson", "https://github.com/holocronweaver"]
- ["Quint Guvernator", "https://github.com/qguv"]
- ["Jose Donizetti", "https://github.com/josedonizetti"]
- ["Alexej Friesen", "https://github.com/heyalexej"]
---
Go was created out of the need to get work done. It's not the latest trend
@ -34,9 +35,10 @@ package main
// Import declaration declares library packages referenced in this file.
import (
"fmt" // A package in the Go standard library.
"io/ioutil" // Implements some I/O utility functions.
m "math" // Math library with local alias m.
"net/http" // Yes, a web server!
"strconv" // String conversions.
m "math" // Math library with local alias m.
)
// A function definition. Main is special. It is the entry point for the
@ -175,8 +177,8 @@ func learnFlowControl() {
break // Just kidding.
continue // Unreached.
}
// As with for, := in an if statement means to declare and assign y first,
// then test y > x.
// As with for, := in an if statement means to declare and assign
// y first, then test y > x.
if y := expensiveComputation(); y > x {
x = y
}
@ -228,8 +230,8 @@ func learnDefer() (ok bool) {
// Deferred statements are executed just before the function returns.
defer fmt.Println("deferred statements execute in reverse (LIFO) order.")
defer fmt.Println("\nThis line is being printed first because")
// Defer is commonly used to close a file, so the function closing the file
// stays close to the function opening the file
// Defer is commonly used to close a file, so the function closing the
// file stays close to the function opening the file.
return true
}
@ -350,10 +352,9 @@ func learnWebProgramming() {
fmt.Println(err) // don't ignore errors
}()
requestServer();
requestServer()
}
// Make pair an http.Handler by implementing its only method, ServeHTTP.
func (p pair) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Serve data with a method of http.ResponseWriter.