1
0
mirror of https://github.com/golang/go synced 2024-11-26 18:16:48 -07:00
go/usr/gri/gosrc/go.go
Robert Griesemer 6dd92ea6cb - fixed import bug (import "...")
- better debugging support
- removed dead code

R=r
OCL=13680
CL=13680
2008-07-30 21:26:15 -07:00

56 lines
1.3 KiB
Go

// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import Build "build"
import Globals "globals"
import Compilation "compilation"
// For now we are not using the flags package to minimize
// external dependencies, and because the requirements are
// very minimal at this point.
func PrintHelp() {
print "go in go (", Build.time, ")\n";
print "usage:\n";
print " go { flag | file }\n";
print " -d print debug information\n";
print " -p print export\n";
print " -s enable semantic checks\n";
print " -v verbose mode\n";
print " -vv very verbose mode\n";
print " -6g 6g compatibility mode\n";
}
func main() {
if sys.argc() <= 1 {
PrintHelp();
sys.exit(1);
}
// collect flags and files
flags := new(Globals.Flags);
files := Globals.NewList();
for i := 1; i < sys.argc(); i++ {
switch arg := sys.argv(i); arg {
case "-d": flags.debug = true;
case "-p": flags.print_export = true;
case "-s": flags.semantic_checks = true;
case "-v": flags.verbose = 1;
case "-vv": flags.verbose = 2;
case "-6g": flags.sixg = true;
default: files.AddStr(arg);
}
}
// compile files
for p := files.first; p != nil; p = p.next {
comp := Globals.NewCompilation(flags);
Compilation.Compile(comp, p.str);
}
}