Source file src/cmd/gc/doc.go
1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 7 Gc is the generic label for the family of Go compilers 8 that function as part of the (modified) Plan 9 tool chain. The C compiler 9 documentation at 10 11 http://plan9.bell-labs.com/sys/doc/comp.pdf (Tools overview) 12 http://plan9.bell-labs.com/sys/doc/compiler.pdf (C compiler architecture) 13 14 gives the overall design of the tool chain. Aside from a few adapted pieces, 15 such as the optimizer, the Go compilers are wholly new programs. 16 17 The compiler reads in a set of Go files, typically suffixed ".go". They 18 must all be part of one package. The output is a single intermediate file 19 representing the "binary assembly" of the compiled package, ready as input 20 for the linker (6l, etc.). 21 22 The generated files contain type information about the symbols exported by 23 the package and about types used by symbols imported by the package from 24 other packages. It is therefore not necessary when compiling client C of 25 package P to read the files of P's dependencies, only the compiled output 26 of P. 27 28 Usage: 29 6g [flags] file... 30 The specified files must be Go source files and all part of the same package. 31 Substitute 6g with 8g or 5g where appropriate. 32 33 Flags: 34 -o file 35 output file, default file.6 for 6g, etc. 36 -e 37 normally the compiler quits after 10 errors; -e prints all errors 38 -L 39 show entire file path when printing line numbers in errors 40 -I dir1 -I dir2 41 add dir1 and dir2 to the list of paths to check for imported packages 42 -N 43 disable optimization 44 -S 45 write assembly language text to standard output 46 -u 47 disallow importing packages not marked as safe 48 -V 49 print the compiler version 50 51 There are also a number of debugging flags; run the command with no arguments 52 to get a usage message. 53 54 */ 55 package documentation