]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/yacc: spring cleaning for units.y
authorBenny Siegert <bsiegert@gmail.com>
Mon, 9 Apr 2012 19:04:59 +0000 (15:04 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 9 Apr 2012 19:04:59 +0000 (15:04 -0400)
* sort imports
* use runtime.GOROOT
* fix some typos

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5987054

src/cmd/yacc/units.y

index 7258e3e5975a414e326f6fc3150f8374d070a587..eaa3fb18a48b6cd019583d839f1a21667916ddf7 100644 (file)
 package main
 
 import (
+       "bufio"
        "flag"
        "fmt"
-       "bufio"
-       "os"
        "math"
+       "runtime"
+       "os"
+       "path/filepath"
        "strconv"
        "unicode/utf8"
 )
@@ -287,13 +289,11 @@ func main() {
 
        flag.Parse()
 
-       if dir := os.Getenv("GOROOT"); dir != "" {
-               file = dir + "/src/cmd/yacc/units.txt"
-       }
+       file = filepath.Join(runtime.GOROOT(), "src/cmd/yacc/units.txt")
        if flag.NArg() > 0 {
                file = flag.Arg(0)
        } else if file == "" {
-               fmt.Fprintf(os.Stderr, "can not find data file units.txt; provide it as argument or set $GOROOT\n")
+               fmt.Fprintf(os.Stderr, "cannot find data file units.txt; provide it as argument or set $GOROOT\n")
                os.Exit(1)
        }
 
@@ -308,7 +308,7 @@ func main() {
 
        /*
         * read the 'units' file to
-        * develope a database
+        * develop a database
         */
        lineno = 0
        for {