summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/cgo/gcc.go4
-rw-r--r--src/cmd/cgo/main.go4
-rw-r--r--src/cmd/godoc/index.go64
-rw-r--r--src/cmd/godoc/main.go4
-rw-r--r--src/cmd/goyacc/goyacc.go44
-rw-r--r--src/cmd/hgpatch/main.go12
6 files changed, 33 insertions, 99 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index d2c74e119..9087c9197 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -580,9 +580,7 @@ func (c *typeConv) FuncType(dtype *dwarf.FuncType) *FuncType {
}
// Identifier
-func (c *typeConv) Ident(s string) *ast.Ident {
- return &ast.Ident{Value: s};
-}
+func (c *typeConv) Ident(s string) *ast.Ident { return &ast.Ident{Value: s} }
// Opaque type of n bytes.
func (c *typeConv) Opaque(n int64) ast.Expr {
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go
index 0b67e2453..c80170478 100644
--- a/src/cmd/cgo/main.go
+++ b/src/cmd/cgo/main.go
@@ -16,9 +16,7 @@ import (
"os";
)
-func usage() {
- fmt.Fprint(os.Stderr, "usage: cgo [compiler options] file.go\n");
-}
+func usage() { fmt.Fprint(os.Stderr, "usage: cgo [compiler options] file.go\n") }
var ptrSizeMap = map[string]int64{
"386": 4,
diff --git a/src/cmd/godoc/index.go b/src/cmd/godoc/index.go
index 9db87a7d4..47da83396 100644
--- a/src/cmd/godoc/index.go
+++ b/src/cmd/godoc/index.go
@@ -50,9 +50,7 @@ type RunList struct {
less func(x, y interface{}) bool;
}
-func (h *RunList) Less(i, j int) bool {
- return h.less(h.At(i), h.At(j));
-}
+func (h *RunList) Less(i, j int) bool { return h.less(h.At(i), h.At(j)) }
func (h *RunList) sort(less func(x, y interface{}) bool) {
@@ -142,24 +140,16 @@ func makeSpotInfo(kind SpotKind, lori int, isIndex bool) SpotInfo {
}
-func (x SpotInfo) less(y SpotInfo) bool {
- return x.Lori() < y.Lori();
-}
+func (x SpotInfo) less(y SpotInfo) bool { return x.Lori() < y.Lori() }
-func (x SpotInfo) Kind() SpotKind {
- return SpotKind(x>>1&7);
-}
+func (x SpotInfo) Kind() SpotKind { return SpotKind(x>>1&7) }
-func (x SpotInfo) Lori() int {
- return int(x>>4);
-}
+func (x SpotInfo) Lori() int { return int(x>>4) }
-func (x SpotInfo) IsIndex() bool {
- return x&1 != 0;
-}
+func (x SpotInfo) IsIndex() bool { return x&1 != 0 }
// A Pak describes a Go package.
@@ -182,9 +172,7 @@ type File struct {
}
-func (f *File) less(g *File) bool {
- return f.Path < g.Path;
-}
+func (f *File) less(g *File) bool { return f.Path < g.Path }
// A Spot describes a single occurence of a word.
@@ -195,9 +183,7 @@ type Spot struct {
// Spots are sorted by filename.
-func lessSpot(x, y interface{}) bool {
- return x.(Spot).File.less(y.(Spot).File);
-}
+func lessSpot(x, y interface{}) bool { return x.(Spot).File.less(y.(Spot).File) }
// A FileRun describes a run of Spots of a word in a single file.
@@ -207,15 +193,9 @@ type FileRun struct {
}
-func (f *FileRun) Len() int {
- return len(f.Infos);
-}
-func (f *FileRun) Less(i, j int) bool {
- return f.Infos[i].less(f.Infos[j]);
-}
-func (f *FileRun) Swap(i, j int) {
- f.Infos[i], f.Infos[j] = f.Infos[j], f.Infos[i];
-}
+func (f *FileRun) Len() int { return len(f.Infos) }
+func (f *FileRun) Less(i, j int) bool { return f.Infos[i].less(f.Infos[j]) }
+func (f *FileRun) Swap(i, j int) { f.Infos[i], f.Infos[j] = f.Infos[j], f.Infos[i] }
// newFileRun allocates a new *FileRun from the Spot run [i, j) in h.
@@ -263,15 +243,9 @@ type PakRun struct {
}
// Sorting support for files within a PakRun.
-func (p *PakRun) Len() int {
- return len(p.Files);
-}
-func (p *PakRun) Less(i, j int) bool {
- return p.Files[i].File.less(p.Files[j].File);
-}
-func (p *PakRun) Swap(i, j int) {
- p.Files[i], p.Files[j] = p.Files[j], p.Files[i];
-}
+func (p *PakRun) Len() int { return len(p.Files) }
+func (p *PakRun) Less(i, j int) bool { return p.Files[i].File.less(p.Files[j].File) }
+func (p *PakRun) Swap(i, j int) { p.Files[i], p.Files[j] = p.Files[j], p.Files[i] }
// newPakRun allocates a new *PakRun from the *FileRun run [i, j) in h.
@@ -290,9 +264,7 @@ func newPakRun(h *RunList, i, j int) interface{} {
// PakRuns are sorted by package.
-func lessPakRun(x, y interface{}) bool {
- return x.(*PakRun).Pak.less(&y.(*PakRun).Pak);
-}
+func lessPakRun(x, y interface{}) bool { return x.(*PakRun).Pak.less(&y.(*PakRun).Pak) }
// A HitList describes a list of PakRuns.
@@ -350,9 +322,7 @@ type AltWords struct {
}
-func lessWordPair(x, y interface{}) bool {
- return x.(*wordPair).canon < y.(*wordPair).canon;
-}
+func lessWordPair(x, y interface{}) bool { return x.(*wordPair).canon < y.(*wordPair).canon }
// newAltWords allocates a new *AltWords from the *wordPair run [i, j) in h.
@@ -591,9 +561,7 @@ type Index struct {
}
-func canonical(w string) string {
- return strings.ToLower(w);
-}
+func canonical(w string) string { return strings.ToLower(w) }
// NewIndex creates a new index for the file tree rooted at root.
diff --git a/src/cmd/godoc/main.go b/src/cmd/godoc/main.go
index de051da2b..6c68fcd64 100644
--- a/src/cmd/godoc/main.go
+++ b/src/cmd/godoc/main.go
@@ -183,9 +183,7 @@ func main() {
// 1) set timestamp right away so that the indexer is kicked on
fsTree.set(nil);
// 2) compute initial directory tree in a goroutine so that launch is quick
- go func() {
- fsTree.set(newDirectory(".", maxDirDepth));
- }();
+ go func() { fsTree.set(newDirectory(".", maxDirDepth)) }();
// Start sync goroutine, if enabled.
if *syncCmd != "" && *syncMin > 0 {
diff --git a/src/cmd/goyacc/goyacc.go b/src/cmd/goyacc/goyacc.go
index 7717cc839..ea4c544f8 100644
--- a/src/cmd/goyacc/goyacc.go
+++ b/src/cmd/goyacc/goyacc.go
@@ -131,30 +131,18 @@ const OK = 1
const NOMORE = -1000
// macros for getting associativity and precedence levels
-func ASSOC(i int) int {
- return i&3;
-}
+func ASSOC(i int) int { return i&3 }
-func PLEVEL(i int) int {
- return (i>>4)&077;
-}
+func PLEVEL(i int) int { return (i>>4)&077 }
-func TYPE(i int) int {
- return (i>>10)&077;
-}
+func TYPE(i int) int { return (i>>10)&077 }
// macros for setting associativity and precedence levels
-func SETASC(i, j int) int {
- return i|j;
-}
+func SETASC(i, j int) int { return i|j }
-func SETPLEV(i, j int) int {
- return i|(j<<4);
-}
+func SETPLEV(i, j int) int { return i|(j<<4) }
-func SETTYPE(i, j int) int {
- return i|(j<<10);
-}
+func SETTYPE(i, j int) int { return i|(j<<10) }
// I/O descriptors
var finput *bufio.Reader // input file
@@ -3000,17 +2988,11 @@ func usage() {
exit(1);
}
-func bitset(set Lkset, bit int) int {
- return set[bit>>5]&(1<<uint(bit&31));
-}
+func bitset(set Lkset, bit int) int { return set[bit>>5]&(1<<uint(bit&31)) }
-func setbit(set Lkset, bit int) {
- set[bit>>5] |= (1<<uint(bit&31));
-}
+func setbit(set Lkset, bit int) { set[bit>>5] |= (1<<uint(bit&31)) }
-func mkset() Lkset {
- return make([]int, tbitset);
-}
+func mkset() Lkset { return make([]int, tbitset) }
//
// set a to the union of a and b
@@ -3048,17 +3030,13 @@ func prlook(p Lkset) {
//
var peekrune int
-func isdigit(c int) bool {
- return c >= '0' && c <= '9';
-}
+func isdigit(c int) bool { return c >= '0' && c <= '9' }
func isword(c int) bool {
return c >= 0xa0 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
-func mktemp(t string) string {
- return t;
-}
+func mktemp(t string) string { return t }
//
// return 1 if 2 arrays are equal
diff --git a/src/cmd/hgpatch/main.go b/src/cmd/hgpatch/main.go
index f1f27c506..a46f9ab75 100644
--- a/src/cmd/hgpatch/main.go
+++ b/src/cmd/hgpatch/main.go
@@ -246,13 +246,9 @@ type undo func() os.Error
var undoLog vector.Vector // vector of undo
-func undoRevert(name string) {
- undoLog.Push(undo(func() os.Error { return hgRevert(name) }));
-}
+func undoRevert(name string) { undoLog.Push(undo(func() os.Error { return hgRevert(name) })) }
-func undoRm(name string) {
- undoLog.Push(undo(func() os.Error { return os.Remove(name) }));
-}
+func undoRm(name string) { undoLog.Push(undo(func() os.Error { return os.Remove(name) })) }
func runUndo() {
for i := undoLog.Len() - 1; i >= 0; i-- {
@@ -392,6 +388,4 @@ type runError struct {
err os.Error;
}
-func (e *runError) String() string {
- return strings.Join(e.cmd, " ") + ": " + e.err.String();
-}
+func (e *runError) String() string { return strings.Join(e.cmd, " ") + ": " + e.err.String() }