Merge remote-tracking branches 'nikai3d/patch-4', 'nikai3d/patch-5', 'nikai3d/patch-6' and 'nikai3d/patch-7'

This commit is contained in:
Mark McGranaghan 2012-11-24 11:40:47 -08:00
4 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ import "os/exec"
func main() { func main() {
// For our example we'll exec `ls`. Go requires an // For our example we'll exec `ls`. Go requires an
// abolute path to the binary we want to execute, so // absolute path to the binary we want to execute, so
// we'll use `exec.LookPath` to find it (probably // we'll use `exec.LookPath` to find it (probably
// `/bin/ls`). // `/bin/ls`).
binary, lookErr := exec.LookPath("ls") binary, lookErr := exec.LookPath("ls")
@ -36,7 +36,7 @@ func main() {
env := os.Environ() env := os.Environ()
// Here's the actual `os.Exec` call. If this call is // Here's the actual `os.Exec` call. If this call is
// succesful, the execution of our process will end // successful, the execution of our process will end
// here and be replaced by the `/bin/ls -a -l -h` // here and be replaced by the `/bin/ls -a -l -h`
// process. If there is an error we'll get a return // process. If there is an error we'll get a return
// value. // value.

View File

@ -29,7 +29,7 @@ func main() {
} }
// `range` on map iterates over key/value pairs. // `range` on map iterates over key/value pairs.
kvs := map[string]string{"a": "apple", "b": "bannana"} kvs := map[string]string{"a": "apple", "b": "banana"}
for k, v := range kvs { for k, v := range kvs {
fmt.Printf("%s -> %s\n", k, v) fmt.Printf("%s -> %s\n", k, v)
} }

View File

@ -67,7 +67,7 @@ func main() {
check(err) check(err)
// The `bufio` package implements a buffered // The `bufio` package implements a buffered
// reader that may be useful both for it's efficiency // reader that may be useful both for its efficiency
// with many small reads and because of the additional // with many small reads and because of the additional
// reading methods it provides. // reading methods it provides.
r4 := bufio.NewReader(f) r4 := bufio.NewReader(f)

View File

@ -18,7 +18,7 @@ type ByLength []string
// We implement `sort.Interface` - `Len`, `Less`, and // We implement `sort.Interface` - `Len`, `Less`, and
// `Swap` - on our type so we can use the `sort` package's // `Swap` - on our type so we can use the `sort` package's
// generic `Sort` function. `Len` and `Swap` // generic `Sort` function. `Len` and `Swap`
// will usually be similar accross types and `Less` will // will usually be similar across types and `Less` will
// hold the actual custom sorting logic. In our case we // hold the actual custom sorting logic. In our case we
// want to sort in order of increasing string length, so // want to sort in order of increasing string length, so
// we use `len(s[i])` and `len(s[j])` here. // we use `len(s[i])` and `len(s[j])` here.