mirror of
https://github.com/golang/go
synced 2024-11-26 05:07:59 -07:00
cmd/yacc: spring cleaning for units.y
* sort imports * use runtime.GOROOT * fix some typos R=golang-dev, dave, rsc CC=golang-dev https://golang.org/cl/5987054
This commit is contained in:
parent
494fe3b08f
commit
f6d582db61
@ -26,11 +26,13 @@
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user