]> Cypherpunks repositories - gostls13.git/commitdiff
- fine-tuning of one-line func heuristic (nodes.go)
authorRobert Griesemer <gri@golang.org>
Fri, 6 Nov 2009 22:24:38 +0000 (14:24 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 6 Nov 2009 22:24:38 +0000 (14:24 -0800)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)

R=r, rsc
CC=go-dev
http://go/go-review/1026006

213 files changed:
src/cmd/cgo/gcc.go
src/cmd/cgo/main.go
src/cmd/godoc/index.go
src/cmd/godoc/main.go
src/cmd/goyacc/goyacc.go
src/cmd/hgpatch/main.go
src/pkg/archive/tar/reader.go
src/pkg/archive/tar/writer.go
src/pkg/asn1/asn1.go
src/pkg/asn1/asn1_test.go
src/pkg/big/int.go
src/pkg/big/int_test.go
src/pkg/big/nat.go
src/pkg/bignum/bignum.go
src/pkg/bignum/integer.go
src/pkg/bignum/nrdiv_test.go
src/pkg/bignum/rational.go
src/pkg/bufio/bufio.go
src/pkg/bytes/buffer.go
src/pkg/bytes/bytes.go
src/pkg/bytes/bytes_test.go
src/pkg/compress/flate/huffman_code.go
src/pkg/compress/flate/inflate.go
src/pkg/compress/flate/token.go
src/pkg/compress/gzip/gunzip.go
src/pkg/container/heap/heap.go
src/pkg/container/heap/heap_test.go
src/pkg/container/list/list.go
src/pkg/container/ring/ring_test.go
src/pkg/container/vector/intvector.go
src/pkg/container/vector/stringvector.go
src/pkg/container/vector/vector.go
src/pkg/container/vector/vector_test.go
src/pkg/crypto/aes/block.go
src/pkg/crypto/aes/cipher.go
src/pkg/crypto/block/cbc.go
src/pkg/crypto/block/cfb.go
src/pkg/crypto/block/cmac.go
src/pkg/crypto/block/ecb_test.go
src/pkg/crypto/hmac/hmac.go
src/pkg/crypto/md5/md5.go
src/pkg/crypto/rsa/rsa.go
src/pkg/crypto/sha1/sha1.go
src/pkg/crypto/subtle/constant_time.go
src/pkg/crypto/tls/common.go
src/pkg/crypto/tls/tls.go
src/pkg/debug/dwarf/buf.go
src/pkg/debug/dwarf/type.go
src/pkg/debug/dwarf/type_test.go
src/pkg/debug/elf/elf.go
src/pkg/debug/elf/file.go
src/pkg/debug/gosym/symtab.go
src/pkg/debug/macho/file.go
src/pkg/debug/macho/macho.go
src/pkg/debug/proc/proc.go
src/pkg/debug/proc/proc_linux.go
src/pkg/debug/proc/regs_linux_386.go
src/pkg/debug/proc/regs_linux_amd64.go
src/pkg/debug/proc/regs_linux_arm.go
src/pkg/ebnf/ebnf.go
src/pkg/encoding/ascii85/ascii85.go
src/pkg/encoding/base64/base64.go
src/pkg/encoding/binary/binary.go
src/pkg/encoding/git85/git.go
src/pkg/encoding/hex/hex.go
src/pkg/exp/4s/4s.go
src/pkg/exp/datafmt/datafmt.go
src/pkg/exp/datafmt/datafmt_test.go
src/pkg/exp/draw/arith.go
src/pkg/exp/draw/color.go
src/pkg/exp/eval/abort.go
src/pkg/exp/eval/bridge.go
src/pkg/exp/eval/compiler.go
src/pkg/exp/eval/eval_test.go
src/pkg/exp/eval/expr.go
src/pkg/exp/eval/expr1.go
src/pkg/exp/eval/expr_test.go
src/pkg/exp/eval/func.go
src/pkg/exp/eval/scope.go
src/pkg/exp/eval/stmt.go
src/pkg/exp/eval/stmt_test.go
src/pkg/exp/eval/type.go
src/pkg/exp/eval/typec.go
src/pkg/exp/eval/value.go
src/pkg/exp/eval/world.go
src/pkg/exp/iterable/iterable_test.go
src/pkg/exp/nacl/av/av.go
src/pkg/exp/nacl/av/image.go
src/pkg/exp/nacl/srpc/msg.go
src/pkg/exp/nacl/srpc/server.go
src/pkg/exp/ogle/arch.go
src/pkg/exp/ogle/cmd.go
src/pkg/exp/ogle/event.go
src/pkg/exp/ogle/frame.go
src/pkg/exp/ogle/goroutine.go
src/pkg/exp/ogle/main.go
src/pkg/exp/ogle/process.go
src/pkg/exp/ogle/rtype.go
src/pkg/exp/ogle/rvalue.go
src/pkg/exp/ogle/vars.go
src/pkg/exp/spacewar/pdp1.go
src/pkg/expvar/expvar.go
src/pkg/flag/flag.go
src/pkg/fmt/format.go
src/pkg/fmt/print.go
src/pkg/go/ast/ast.go
src/pkg/go/ast/scope.go
src/pkg/go/doc/comment.go
src/pkg/go/doc/doc.go
src/pkg/go/parser/parser.go
src/pkg/go/parser/parser_test.go
src/pkg/go/printer/nodes.go
src/pkg/go/printer/testdata/comments.golden
src/pkg/go/printer/testdata/declarations.golden
src/pkg/go/printer/testdata/statements.golden
src/pkg/go/scanner/errors.go
src/pkg/go/scanner/scanner_test.go
src/pkg/go/token/token.go
src/pkg/gob/decode.go
src/pkg/gob/type.go
src/pkg/hash/adler32/adler32.go
src/pkg/hash/crc32/crc32.go
src/pkg/http/client.go
src/pkg/http/fs.go
src/pkg/http/request.go
src/pkg/http/server.go
src/pkg/http/triv.go
src/pkg/http/url.go
src/pkg/image/image.go
src/pkg/image/png/reader.go
src/pkg/image/png/writer.go
src/pkg/io/io.go
src/pkg/io/pipe.go
src/pkg/io/utils.go
src/pkg/json/generic.go
src/pkg/json/parse.go
src/pkg/json/struct.go
src/pkg/log/log.go
src/pkg/math/all_test.go
src/pkg/math/bits.go
src/pkg/math/floor.go
src/pkg/math/sin.go
src/pkg/math/unsafe.go
src/pkg/net/dnsclient.go
src/pkg/net/dnsmsg.go
src/pkg/net/fd.go
src/pkg/net/fd_darwin.go
src/pkg/net/fd_nacl.go
src/pkg/net/ipsock.go
src/pkg/net/net.go
src/pkg/net/parse.go
src/pkg/net/tcpsock.go
src/pkg/net/timeout_test.go
src/pkg/net/udpsock.go
src/pkg/net/unixsock.go
src/pkg/once/once_test.go
src/pkg/os/error.go
src/pkg/os/exec.go
src/pkg/os/file.go
src/pkg/os/proc.go
src/pkg/os/sys_nacl.go
src/pkg/os/types.go
src/pkg/patch/patch.go
src/pkg/path/path_test.go
src/pkg/rand/rand.go
src/pkg/reflect/all_test.go
src/pkg/reflect/type.go
src/pkg/reflect/value.go
src/pkg/regexp/regexp.go
src/pkg/rpc/debug.go
src/pkg/rpc/server.go
src/pkg/sort/sort.go
src/pkg/sort/sort_test.go
src/pkg/strconv/atof_test.go
src/pkg/strconv/atoi.go
src/pkg/strconv/ftoa_test.go
src/pkg/strconv/internal_test.go
src/pkg/strconv/itoa.go
src/pkg/strings/reader.go
src/pkg/strings/strings.go
src/pkg/strings/strings_test.go
src/pkg/sync/mutex.go
src/pkg/syscall/exec.go
src/pkg/syscall/syscall.go
src/pkg/syscall/syscall_darwin.go
src/pkg/syscall/syscall_darwin_386.go
src/pkg/syscall/syscall_darwin_amd64.go
src/pkg/syscall/syscall_linux.go
src/pkg/syscall/syscall_linux_386.go
src/pkg/syscall/syscall_linux_amd64.go
src/pkg/syscall/syscall_linux_arm.go
src/pkg/syscall/syscall_nacl.go
src/pkg/syscall/syscall_nacl_386.go
src/pkg/syscall/zsysnum_linux_386.go
src/pkg/syscall/zsysnum_linux_amd64.go
src/pkg/syscall/zsysnum_linux_arm.go
src/pkg/tabwriter/tabwriter.go
src/pkg/tabwriter/tabwriter_test.go
src/pkg/template/template.go
src/pkg/template/template_test.go
src/pkg/testing/iotest/reader.go
src/pkg/testing/quick/quick.go
src/pkg/testing/quick/quick_test.go
src/pkg/testing/regexp.go
src/pkg/testing/script/script.go
src/pkg/testing/testing.go
src/pkg/time/sleep.go
src/pkg/time/tick.go
src/pkg/time/time.go
src/pkg/utf8/utf8.go
src/pkg/xml/read.go
src/pkg/xml/xml.go
src/pkg/xml/xml_test.go

index d2c74e1198c1bcf72cd3b4f5245bf6bbd28112b0..9087c9197c517bf65736ba5189fabceec9757dc8 100644 (file)
@@ -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 {
index 0b67e245343dd9b094d4cb505962c7ed0472896e..c80170478050015fa5fdb49bbfc66f53ea71fa73 100644 (file)
@@ -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,
index 9db87a7d44f1b5daa6f4e6cb01d149eb0a6cc5e2..47da833966451d729c90ffc017f356f9c172f332 100644 (file)
@@ -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.
index de051da2bfed3c86c71bb02ff43557265976b600..6c68fcd6499caee5bf717293d0509fa52666c03d 100644 (file)
@@ -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 {
index 7717cc8395faac1a5345a8b5ca2a4d7245059862..ea4c544f8c7baf90ad3021e2924d1fc12221de91 100644 (file)
@@ -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
index f1f27c5062d76787d50d88c487cd2b244dc05f8e..a46f9ab75f1069c53400f57f453a433cf564708c 100644 (file)
@@ -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() }
index d5e45288c86bb2abfe632604f37279af04570605..8cb40304d753bc06e5c2ac2ae9a674be9b1f705b 100644 (file)
@@ -44,9 +44,7 @@ type Reader struct {
 }
 
 // NewReader creates a new Reader reading from r.
-func NewReader(r io.Reader) *Reader {
-       return &Reader{r: r};
-}
+func NewReader(r io.Reader) *Reader    { return &Reader{r: r} }
 
 // Next advances to the next entry in the tar archive.
 func (tr *Reader) Next() (*Header, os.Error) {
index 68ec2afe9ce63761d4d319f25abe428598fbc134..a3c03cef14d8f6b0bc5d67ebd80de74e6732eb2b 100644 (file)
@@ -45,9 +45,7 @@ type Writer struct {
 }
 
 // NewWriter creates a new Writer writing to w.
-func NewWriter(w io.Writer) *Writer {
-       return &Writer{w: w};
-}
+func NewWriter(w io.Writer) *Writer    { return &Writer{w: w} }
 
 // Flush finishes writing the current file (optional).
 func (tw *Writer) Flush() os.Error {
index e89adb2729a2393f168553e2d318d33da6acb318..642a6ad2bf1a89eb7d77af40801444e81e84a483 100644 (file)
@@ -34,18 +34,14 @@ type StructuralError struct {
        Msg string;
 }
 
-func (e StructuralError) String() string {
-       return "ASN.1 structure error: " + e.Msg;
-}
+func (e StructuralError) String() string       { return "ASN.1 structure error: " + e.Msg }
 
 // A SyntaxError suggests that the ASN.1 data is invalid.
 type SyntaxError struct {
        Msg string;
 }
 
-func (e SyntaxError) String() string {
-       return "ASN.1 syntax error: " + e.Msg;
-}
+func (e SyntaxError) String() string   { return "ASN.1 syntax error: " + e.Msg }
 
 // We start by dealing with each of the primitive types in turn.
 
@@ -190,9 +186,7 @@ func parseBase128Int(bytes []byte, initOffset int) (ret, offset int, err os.Erro
 
 // UTCTime
 
-func isDigit(b byte) bool {
-       return '0' <= b && b <= '9';
-}
+func isDigit(b byte) bool      { return '0' <= b && b <= '9' }
 
 // twoDigits returns the value of two, base 10 digits.
 func twoDigits(bytes []byte, max int) (int, bool) {
index ca27292253a70e377047922e5e47a9e1641c502b..f9a7106d94e92c38d793ce71a0c13f3689ec6bf3 100644 (file)
@@ -190,21 +190,13 @@ type parseFieldParametersTest struct {
        out     fieldParameters;
 }
 
-func newInt(n int) *int {
-       return &n;
-}
+func newInt(n int) *int        { return &n }
 
-func newInt64(n int64) *int64 {
-       return &n;
-}
+func newInt64(n int64) *int64  { return &n }
 
-func newString(s string) *string {
-       return &s;
-}
+func newString(s string) *string       { return &s }
 
-func newBool(b bool) *bool {
-       return &b;
-}
+func newBool(b bool) *bool     { return &b }
 
 var parseFieldParametersTestData []parseFieldParametersTest = []parseFieldParametersTest{
        parseFieldParametersTest{"", fieldParameters{false, false, nil, nil}},
index 5db4f0901aee272bcfe10f79a70e1ce1084110cf..235becfeb3f3176fac02be711010bb4f9224db75 100644 (file)
@@ -27,9 +27,7 @@ func (z *Int) New(x int64) *Int {
 
 
 // NewInt allocates and returns a new Int set to x.
-func NewInt(x int64) *Int {
-       return new(Int).New(x);
-}
+func NewInt(x int64) *Int      { return new(Int).New(x) }
 
 
 // Set sets z to x.
index 442b76fcc0e943dab110ed199a4321d79fcab4bc..a89b7aa9e054c6820845b98794be0d5d7c14e028 100644 (file)
@@ -264,8 +264,8 @@ func checkDiv(x, y []byte) bool {
 
 
 type divTest struct {
-       x, y string;
-       q, r string;
+       x, y    string;
+       q, r    string;
 }
 
 
index 9a59f049ca999846f79057943210f8dce2d529d5..99ddefb6276262c307a9980d53f5e6699408cd27 100644 (file)
@@ -482,6 +482,4 @@ func shiftRight(dst, src []Word, n int) {
 
 
 // greaterThan returns true iff (x1<<_W + x2) > (y1<<_W + y2)
-func greaterThan(x1, x2, y1, y2 Word) bool {
-       return x1 > y1 || x1 == y1 && x2 > y2;
-}
+func greaterThan(x1, x2, y1, y2 Word) bool     { return x1 > y1 || x1 == y1 && x2 > y2 }
index 961d19c422727d81f6b3ecef14f4cbdb6d52964c..ed61dad6bd4d4b3cd9be12393bc2ba9473464cc6 100755 (executable)
@@ -88,9 +88,7 @@ func assert(p bool) {
 }
 
 
-func isSmall(x digit) bool {
-       return x < 1<<logH;
-}
+func isSmall(x digit) bool     { return x < 1<<logH }
 
 
 // For debugging. Keep around.
@@ -176,23 +174,17 @@ func (x Natural) Value() uint64 {
 
 // IsEven returns true iff x is divisible by 2.
 //
-func (x Natural) IsEven() bool {
-       return len(x) == 0 || x[0]&1 == 0;
-}
+func (x Natural) IsEven() bool { return len(x) == 0 || x[0]&1 == 0 }
 
 
 // IsOdd returns true iff x is not divisible by 2.
 //
-func (x Natural) IsOdd() bool {
-       return len(x) > 0 && x[0]&1 != 0;
-}
+func (x Natural) IsOdd() bool  { return len(x) > 0 && x[0]&1 != 0 }
 
 
 // IsZero returns true iff x == 0.
 //
-func (x Natural) IsZero() bool {
-       return len(x) == 0;
-}
+func (x Natural) IsZero() bool { return len(x) == 0 }
 
 
 // Operations
@@ -867,9 +859,7 @@ func (x Natural) ToString(base uint) string {
 // String converts x to its decimal string representation.
 // x.String() is the same as x.ToString(10).
 //
-func (x Natural) String() string {
-       return x.ToString(10);
-}
+func (x Natural) String() string       { return x.ToString(10) }
 
 
 func fmtbase(c int) uint {
@@ -888,9 +878,7 @@ func fmtbase(c int) uint {
 // Format is a support routine for fmt.Formatter. It accepts
 // the formats 'b' (binary), 'o' (octal), and 'x' (hexadecimal).
 //
-func (x Natural) Format(h fmt.State, c int) {
-       fmt.Fprintf(h, "%s", x.ToString(fmtbase(c)));
-}
+func (x Natural) Format(h fmt.State, c int)    { fmt.Fprintf(h, "%s", x.ToString(fmtbase(c))) }
 
 
 func hexvalue(ch byte) uint {
@@ -1015,9 +1003,7 @@ func Fact(n uint) Natural {
 
 // Binomial computes the binomial coefficient of (n, k).
 //
-func Binomial(n, k uint) Natural {
-       return MulRange(n-k+1, n).Div(MulRange(1, k));
-}
+func Binomial(n, k uint) Natural       { return MulRange(n-k+1, n).Div(MulRange(1, k)) }
 
 
 // Gcd computes the gcd of x and y.
index 0d0d0ed8e7e0d21204682bb9eb524495ab7deffc..d305625b5a78cf02ed7597d98eef9e55252f3f87 100644 (file)
@@ -64,55 +64,41 @@ func (x *Integer) Value() int64 {
 
 // Abs returns the absolute value of x.
 //
-func (x *Integer) Abs() Natural {
-       return x.mant;
-}
+func (x *Integer) Abs() Natural        { return x.mant }
 
 
 // Predicates
 
 // IsEven returns true iff x is divisible by 2.
 //
-func (x *Integer) IsEven() bool {
-       return x.mant.IsEven();
-}
+func (x *Integer) IsEven() bool        { return x.mant.IsEven() }
 
 
 // IsOdd returns true iff x is not divisible by 2.
 //
-func (x *Integer) IsOdd() bool {
-       return x.mant.IsOdd();
-}
+func (x *Integer) IsOdd() bool { return x.mant.IsOdd() }
 
 
 // IsZero returns true iff x == 0.
 //
-func (x *Integer) IsZero() bool {
-       return x.mant.IsZero();
-}
+func (x *Integer) IsZero() bool        { return x.mant.IsZero() }
 
 
 // IsNeg returns true iff x < 0.
 //
-func (x *Integer) IsNeg() bool {
-       return x.sign && !x.mant.IsZero();
-}
+func (x *Integer) IsNeg() bool { return x.sign && !x.mant.IsZero() }
 
 
 // IsPos returns true iff x >= 0.
 //
-func (x *Integer) IsPos() bool {
-       return !x.sign && !x.mant.IsZero();
-}
+func (x *Integer) IsPos() bool { return !x.sign && !x.mant.IsZero() }
 
 
 // Operations
 
 // Neg returns the negated value of x.
 //
-func (x *Integer) Neg() *Integer {
-       return MakeInt(!x.sign, x.mant);
-}
+func (x *Integer) Neg() *Integer       { return MakeInt(!x.sign, x.mant) }
 
 
 // Iadd sets z to the sum x + y.
@@ -323,9 +309,7 @@ func (x *Integer) DivMod(y *Integer) (*Integer, *Integer) {
 
 // Shl implements ``shift left'' x << s. It returns x * 2^s.
 //
-func (x *Integer) Shl(s uint) *Integer {
-       return MakeInt(x.sign, x.mant.Shl(s));
-}
+func (x *Integer) Shl(s uint) *Integer { return MakeInt(x.sign, x.mant.Shl(s)) }
 
 
 // The bitwise operations on integers are defined on the 2's-complement
@@ -504,17 +488,13 @@ func (x *Integer) ToString(base uint) string {
 // String converts x to its decimal string representation.
 // x.String() is the same as x.ToString(10).
 //
-func (x *Integer) String() string {
-       return x.ToString(10);
-}
+func (x *Integer) String() string      { return x.ToString(10) }
 
 
 // Format is a support routine for fmt.Formatter. It accepts
 // the formats 'b' (binary), 'o' (octal), and 'x' (hexadecimal).
 //
-func (x *Integer) Format(h fmt.State, c int) {
-       fmt.Fprintf(h, "%s", x.ToString(fmtbase(c)));
-}
+func (x *Integer) Format(h fmt.State, c int)   { fmt.Fprintf(h, "%s", x.ToString(fmtbase(c))) }
 
 
 // IntFromString returns the integer corresponding to the
index 5fdc31a77dd2e6c1b95bb6a2832b0d61987067d1..a695e73c5beb43a12183ce15393e40d73b63f7f8 100644 (file)
@@ -39,15 +39,11 @@ func (x fpNat) sub(y fpNat) fpNat {
 
 
 // mul2 computes x*2.
-func (x fpNat) mul2() fpNat {
-       return fpNat{x.m, x.e + 1};
-}
+func (x fpNat) mul2() fpNat    { return fpNat{x.m, x.e + 1} }
 
 
 // mul computes x*y.
-func (x fpNat) mul(y fpNat) fpNat {
-       return fpNat{x.m.Mul(y.m), x.e + y.e};
-}
+func (x fpNat) mul(y fpNat) fpNat      { return fpNat{x.m.Mul(y.m), x.e + y.e} }
 
 
 // mant computes the (possibly truncated) Natural representation
@@ -169,9 +165,7 @@ func div(t *testing.T, x, y Natural) {
 }
 
 
-func idiv(t *testing.T, x0, y0 uint64) {
-       div(t, Nat(x0), Nat(y0));
-}
+func idiv(t *testing.T, x0, y0 uint64) { div(t, Nat(x0), Nat(y0)) }
 
 
 func TestNRDiv(t *testing.T) {
index 5f7423bacd4c967038c5061395a95519ecf72f81..6cdc1f34416d75c4495d22ee8e1eef770fc26b50 100644 (file)
@@ -51,40 +51,30 @@ func (x *Rational) Value() (numerator *Integer, denominator Natural) {
 
 // IsZero returns true iff x == 0.
 //
-func (x *Rational) IsZero() bool {
-       return x.a.IsZero();
-}
+func (x *Rational) IsZero() bool       { return x.a.IsZero() }
 
 
 // IsNeg returns true iff x < 0.
 //
-func (x *Rational) IsNeg() bool {
-       return x.a.IsNeg();
-}
+func (x *Rational) IsNeg() bool        { return x.a.IsNeg() }
 
 
 // IsPos returns true iff x > 0.
 //
-func (x *Rational) IsPos() bool {
-       return x.a.IsPos();
-}
+func (x *Rational) IsPos() bool        { return x.a.IsPos() }
 
 
 // IsInt returns true iff x can be written with a denominator 1
 // in the form x == x'/1; i.e., if x is an integer value.
 //
-func (x *Rational) IsInt() bool {
-       return x.b.Cmp(Nat(1)) == 0;
-}
+func (x *Rational) IsInt() bool        { return x.b.Cmp(Nat(1)) == 0 }
 
 
 // Operations
 
 // Neg returns the negated value of x.
 //
-func (x *Rational) Neg() *Rational {
-       return MakeRat(x.a.Neg(), x.b);
-}
+func (x *Rational) Neg() *Rational     { return MakeRat(x.a.Neg(), x.b) }
 
 
 // Add returns the sum x + y.
@@ -103,9 +93,7 @@ func (x *Rational) Sub(y *Rational) *Rational {
 
 // Mul returns the product x * y.
 //
-func (x *Rational) Mul(y *Rational) *Rational {
-       return MakeRat(x.a.Mul(y.a), x.b.Mul(y.b));
-}
+func (x *Rational) Mul(y *Rational) *Rational  { return MakeRat(x.a.Mul(y.a), x.b.Mul(y.b)) }
 
 
 // Quo returns the quotient x / y for y != 0.
@@ -127,9 +115,7 @@ func (x *Rational) Quo(y *Rational) *Rational {
 //   == 0 if x == y
 //   >  0 if x >  y
 //
-func (x *Rational) Cmp(y *Rational) int {
-       return (x.a.MulNat(y.b)).Cmp(y.a.MulNat(x.b));
-}
+func (x *Rational) Cmp(y *Rational) int        { return (x.a.MulNat(y.b)).Cmp(y.a.MulNat(x.b)) }
 
 
 // ToString converts x to a string for a given base, with 2 <= base <= 16.
@@ -148,17 +134,13 @@ func (x *Rational) ToString(base uint) string {
 // String converts x to its decimal string representation.
 // x.String() is the same as x.ToString(10).
 //
-func (x *Rational) String() string {
-       return x.ToString(10);
-}
+func (x *Rational) String() string     { return x.ToString(10) }
 
 
 // Format is a support routine for fmt.Formatter. It accepts
 // the formats 'b' (binary), 'o' (octal), and 'x' (hexadecimal).
 //
-func (x *Rational) Format(h fmt.State, c int) {
-       fmt.Fprintf(h, "%s", x.ToString(fmtbase(c)));
-}
+func (x *Rational) Format(h fmt.State, c int)  { fmt.Fprintf(h, "%s", x.ToString(fmtbase(c))) }
 
 
 // RatFromString returns the rational number corresponding to the
index 5b71182c4199a856e2f5846c26ece89f36f655df..e66d72a353b29a8ea375bcd1d770dd4b5f52091e 100644 (file)
@@ -211,9 +211,7 @@ func findByte(p []byte, c byte) int {
 }
 
 // Buffered returns the number of bytes that can be read from the current buffer.
-func (b *Reader) Buffered() int {
-       return b.w - b.r;
-}
+func (b *Reader) Buffered() int        { return b.w - b.r }
 
 // ReadSlice reads until the first occurrence of delim in the input,
 // returning a slice pointing at the bytes in the buffer.
@@ -404,14 +402,10 @@ func (b *Writer) Flush() os.Error {
 }
 
 // Available returns how many bytes are unused in the buffer.
-func (b *Writer) Available() int {
-       return len(b.buf) - b.n;
-}
+func (b *Writer) Available() int       { return len(b.buf) - b.n }
 
 // Buffered returns the number of bytes that have been written into the current buffer.
-func (b *Writer) Buffered() int {
-       return b.n;
-}
+func (b *Writer) Buffered() int        { return b.n }
 
 // Write writes the contents of p into the buffer.
 // It returns the number of bytes written.
index 875086525e6deaf64d30d8f80ea6d457d66b1ee6..a448dff845898579d6f90034b3540db586aaa913 100644 (file)
@@ -37,9 +37,7 @@ type Buffer struct {
 
 // Bytes returns the contents of the unread portion of the buffer;
 // len(b.Bytes()) == b.Len().
-func (b *Buffer) Bytes() []byte {
-       return b.buf[b.off : len(b.buf)];
-}
+func (b *Buffer) Bytes() []byte        { return b.buf[b.off : len(b.buf)] }
 
 // String returns the contents of the unread portion of the buffer
 // as a string.  If the Buffer is a nil pointer, it returns "<nil>".
@@ -53,9 +51,7 @@ func (b *Buffer) String() string {
 
 // Len returns the number of bytes of the unread portion of the buffer;
 // b.Len() == len(b.Bytes()).
-func (b *Buffer) Len() int {
-       return len(b.buf) - b.off;
-}
+func (b *Buffer) Len() int     { return len(b.buf) - b.off }
 
 // Truncate discards all but the first n unread bytes from the buffer.
 // It is an error to call b.Truncate(n) with n > b.Len().
@@ -69,9 +65,7 @@ func (b *Buffer) Truncate(n int) {
 
 // Reset resets the buffer so it has no content.
 // b.Reset() is the same as b.Truncate(0).
-func (b *Buffer) Reset() {
-       b.Truncate(0);
-}
+func (b *Buffer) Reset()       { b.Truncate(0) }
 
 // Write appends the contents of p to the buffer.  The return
 // value n is the length of p; err is always nil.
@@ -166,9 +160,7 @@ func (b *Buffer) ReadByte() (c byte, err os.Error) {
 
 // NewBuffer creates and initializes a new Buffer
 // using buf as its initial contents.
-func NewBuffer(buf []byte) *Buffer {
-       return &Buffer{buf: buf};
-}
+func NewBuffer(buf []byte) *Buffer     { return &Buffer{buf: buf} }
 
 // NewBufferString creates and initializes a new Buffer
 // using string s as its initial contents.
index 05d87fcb6a53766a7a5f05b63af371fd2a8a65a6..3ebc8373ab4659b29a77a16d3602a9733ec4322d 100644 (file)
@@ -155,9 +155,7 @@ func genSplit(s, sep []byte, sepSave, n int) [][]byte {
 // Split splits the array s around each instance of sep, returning an array of subarrays of s.
 // If sep is empty, Split splits s after each UTF-8 sequence.
 // If n > 0, Split splits s into at most n subarrays; the last subarray will contain an unsplit remainder.
-func Split(s, sep []byte, n int) [][]byte {
-       return genSplit(s, sep, 0, n);
-}
+func Split(s, sep []byte, n int) [][]byte      { return genSplit(s, sep, 0, n) }
 
 // SplitAfter splits the array s after each instance of sep, returning an array of subarrays of s.
 // If sep is empty, SplitAfter splits s after each UTF-8 sequence.
@@ -244,19 +242,13 @@ func Map(mapping func(rune int) int, s []byte) []byte {
 }
 
 // ToUpper returns a copy of the byte array s with all Unicode letters mapped to their upper case.
-func ToUpper(s []byte) []byte {
-       return Map(unicode.ToUpper, s);
-}
+func ToUpper(s []byte) []byte  { return Map(unicode.ToUpper, s) }
 
 // ToUpper returns a copy of the byte array s with all Unicode letters mapped to their lower case.
-func ToLower(s []byte) []byte {
-       return Map(unicode.ToLower, s);
-}
+func ToLower(s []byte) []byte  { return Map(unicode.ToLower, s) }
 
 // ToTitle returns a copy of the byte array s with all Unicode letters mapped to their title case.
-func ToTitle(s []byte) []byte {
-       return Map(unicode.ToTitle, s);
-}
+func ToTitle(s []byte) []byte  { return Map(unicode.ToTitle, s) }
 
 // Trim returns a slice of the string s, with all leading and trailing white space
 // removed, as defined by Unicode.
index ee727f0cd589bc11de6036cfa3253e78a51d56f8..b00de1b0cdeec1e9667a49e8fe2c23cefdc449b6 100644 (file)
@@ -287,17 +287,11 @@ func TestMap(t *testing.T) {
        }
 }
 
-func TestToUpper(t *testing.T) {
-       runStringTests(t, ToUpper, "ToUpper", upperTests);
-}
+func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTests) }
 
-func TestToLower(t *testing.T) {
-       runStringTests(t, ToLower, "ToLower", lowerTests);
-}
+func TestToLower(t *testing.T) { runStringTests(t, ToLower, "ToLower", lowerTests) }
 
-func TestTrimSpace(t *testing.T) {
-       runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests);
-}
+func TestTrimSpace(t *testing.T)       { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) }
 
 type AddTest struct {
        s, t    string;
index 8929697bcd635a588bd7ea1ce8708bb81ebac0a9..eecfceb9c1d8ca6eeb58a11ae3dc59ddbd097ff0 100644 (file)
@@ -55,9 +55,7 @@ type levelInfo struct {
        down    *levelInfo;
 }
 
-func maxNode() literalNode {
-       return literalNode{math.MaxUint16, math.MaxInt32};
-}
+func maxNode() literalNode     { return literalNode{math.MaxUint16, math.MaxInt32} }
 
 func newHuffmanEncoder(size int) *huffmanEncoder {
        return &huffmanEncoder{make([]uint8, size), make([]uint16, size)};
@@ -357,17 +355,13 @@ type literalNodeSorter struct {
        less    func(i, j int) bool;
 }
 
-func (s literalNodeSorter) Len() int {
-       return len(s.a);
-}
+func (s literalNodeSorter) Len() int   { return len(s.a) }
 
 func (s literalNodeSorter) Less(i, j int) bool {
        return s.less(i, j);
 }
 
-func (s literalNodeSorter) Swap(i, j int) {
-       s.a[i], s.a[j] = s.a[j], s.a[i];
-}
+func (s literalNodeSorter) Swap(i, j int)      { s.a[i], s.a[j] = s.a[j], s.a[i] }
 
 func sortByFreq(a []literalNode) {
        s := &literalNodeSorter{a, func(i, j int) bool { return a[i].freq < a[j].freq }};
index 149cb08c7eeb5e24839d2dba1010efddd3fabe33..96bbcb65344ec44ebf9f51f51858ff1ec69f4f6a 100644 (file)
@@ -32,9 +32,7 @@ func (e CorruptInputError) String() string {
 // An InternalError reports an error in the flate code itself.
 type InternalError string
 
-func (e InternalError) String() string {
-       return "flate: internal error: " + string(e);
-}
+func (e InternalError) String() string { return "flate: internal error: " + string(e) }
 
 // A ReadError reports an error encountered while reading input.
 type ReadError struct {
index 476eae7832a82be30d0699f5de7797a1ecc576b4..d37730ca574be04735fd10ea4994b698888cf810 100644 (file)
@@ -68,9 +68,7 @@ var offsetCodes = [...]uint32{
 type token uint32
 
 // Convert a literal into a literal token.
-func literalToken(literal uint32) token {
-       return token(literalType + literal);
-}
+func literalToken(literal uint32) token        { return token(literalType + literal) }
 
 // Convert a < xlength, xoffset > pair into a match token.
 func matchToken(xlength uint32, xoffset uint32) token {
@@ -78,27 +76,17 @@ func matchToken(xlength uint32, xoffset uint32) token {
 }
 
 // Returns the type of a token
-func (t token) typ() uint32 {
-       return uint32(t)&typeMask;
-}
+func (t token) typ() uint32    { return uint32(t)&typeMask }
 
 // Returns the literal of a literal token
-func (t token) literal() uint32 {
-       return uint32(t - literalType);
-}
+func (t token) literal() uint32        { return uint32(t - literalType) }
 
 // Returns the extra offset of a match token
-func (t token) offset() uint32 {
-       return uint32(t) & offsetMask;
-}
+func (t token) offset() uint32 { return uint32(t) & offsetMask }
 
-func (t token) length() uint32 {
-       return uint32((t - matchType) >> lengthShift);
-}
+func (t token) length() uint32 { return uint32((t - matchType) >> lengthShift) }
 
-func lengthCode(len uint32) uint32 {
-       return lengthCodes[len];
-}
+func lengthCode(len uint32) uint32     { return lengthCodes[len] }
 
 // Returns the offset code corresponding to a specific offset
 func offsetCode(off uint32) uint32 {
index 07906cd384e6491aadedd5a02f2147ef125913b3..3dbfeca6527c58127f775d8622e62263722af018 100644 (file)
@@ -220,6 +220,4 @@ func (z *Inflater) Read(p []byte) (n int, err os.Error) {
 }
 
 // Calling Close does not close the wrapped io.Reader originally passed to NewInflater.
-func (z *Inflater) Close() os.Error {
-       return z.inflater.Close();
-}
+func (z *Inflater) Close() os.Error    { return z.inflater.Close() }
index f78e3b3a5da0e8e352a3e612b8d7e4cbf4e362c4..100dcad054fd428180159005f44973e2059335e1 100644 (file)
@@ -27,9 +27,7 @@ type Interface interface {
 // and may be called whenever the heap invariants may have been invalidated.
 // Its complexity is O(n*log(n)) where n = h.Len().
 //
-func Init(h Interface) {
-       sort.Sort(h);
-}
+func Init(h Interface) { sort.Sort(h) }
 
 
 // Push pushes the element x onto the heap. The complexity is
index 99722f2e9bdc647f778ba8c2ab34675c25635121..2375906b967fc1022b8ccfd9c1dd91a928498dd6 100644 (file)
@@ -43,14 +43,10 @@ func (h *myHeap) verify(t *testing.T, i int) {
 }
 
 
-func (h *myHeap) Push(x interface{}) {
-       h.IntVector.Push(x.(int));
-}
+func (h *myHeap) Push(x interface{})   { h.IntVector.Push(x.(int)) }
 
 
-func (h *myHeap) Pop() interface{} {
-       return h.IntVector.Pop();
-}
+func (h *myHeap) Pop() interface{}     { return h.IntVector.Pop() }
 
 
 func TestInit(t *testing.T) {
index acd34c4175c88f7dfbf4ce141daa0d9a40c08bc3..b1f12080f05b3f462a63469b0c3ee53d72feb2bc 100755 (executable)
@@ -19,14 +19,10 @@ type Element struct {
 }
 
 // Next returns the next list element or nil.
-func (e *Element) Next() *Element {
-       return e.next;
-}
+func (e *Element) Next() *Element      { return e.next }
 
 // Prev returns the previous list element or nil.
-func (e *Element) Prev() *Element {
-       return e.prev;
-}
+func (e *Element) Prev() *Element      { return e.prev }
 
 // List represents a doubly linked list.
 type List struct {
@@ -45,19 +41,13 @@ func (l *List) Init() *List {
 }
 
 // New returns an initialized list.
-func New() *List {
-       return new(List).Init();
-}
+func New() *List       { return new(List).Init() }
 
 // Front returns the first element in the list.
-func (l *List) Front() *Element {
-       return l.front;
-}
+func (l *List) Front() *Element        { return l.front }
 
 // Back returns the last element in the list.
-func (l *List) Back() *Element {
-       return l.back;
-}
+func (l *List) Back() *Element { return l.back }
 
 // Remove removes the element from the list.
 func (l *List) Remove(e *Element) {
@@ -187,9 +177,7 @@ func (l *List) MoveToBack(e *Element) {
 }
 
 // Len returns the number of elements in the list.
-func (l *List) Len() int {
-       return l.len;
-}
+func (l *List) Len() int       { return l.len }
 
 func (l *List) iterate(c chan<- interface{}) {
        for e := l.front; e != nil; e = e.next {
index 0dc3a71d1c311052dd1732f505fe2175b9ae71b8..7032cdfcff5f5b3dea92402170fd312fc140b10e 100644 (file)
@@ -138,9 +138,7 @@ func sum(r *Ring) int {
 }
 
 
-func sumN(n int) int {
-       return (n*n + n)/2;
-}
+func sumN(n int) int   { return (n*n + n)/2 }
 
 
 func TestNew(t *testing.T) {
index 9db25295808effba5a5c98295c4e42ea3de91fd0..e17d619ad63f9dbc1bfbe8f24330275b3cd5e159 100644 (file)
@@ -21,27 +21,19 @@ func (p *IntVector) Init(len int) *IntVector {
 
 
 // NewIntVector returns an initialized new IntVector with length at least len.
-func NewIntVector(len int) *IntVector {
-       return new(IntVector).Init(len);
-}
+func NewIntVector(len int) *IntVector  { return new(IntVector).Init(len) }
 
 
 // At returns the i'th element of the vector.
-func (p *IntVector) At(i int) int {
-       return p.Vector.At(i).(int);
-}
+func (p *IntVector) At(i int) int      { return p.Vector.At(i).(int) }
 
 
 // Set sets the i'th element of the vector to value x.
-func (p *IntVector) Set(i int, x int) {
-       p.a[i] = x;
-}
+func (p *IntVector) Set(i int, x int)  { p.a[i] = x }
 
 
 // Last returns the element in the vector of highest index.
-func (p *IntVector) Last() int {
-       return p.Vector.Last().(int);
-}
+func (p *IntVector) Last() int { return p.Vector.Last().(int) }
 
 
 // Data returns all the elements as a slice.
@@ -56,9 +48,7 @@ func (p *IntVector) Data() []int {
 
 // Insert inserts into the vector an element of value x before
 // the current element at index i.
-func (p *IntVector) Insert(i int, x int) {
-       p.Vector.Insert(i, x);
-}
+func (p *IntVector) Insert(i int, x int)       { p.Vector.Insert(i, x) }
 
 
 // InsertVector inserts into the vector the contents of the Vector
@@ -76,15 +66,11 @@ func (p *IntVector) Slice(i, j int) *IntVector {
 
 
 // Push appends x to the end of the vector.
-func (p *IntVector) Push(x int) {
-       p.Vector.Push(x);
-}
+func (p *IntVector) Push(x int)        { p.Vector.Push(x) }
 
 
 // Pop deletes and returns the last element of the vector.
-func (p *IntVector) Pop() int {
-       return p.Vector.Pop().(int);
-}
+func (p *IntVector) Pop() int  { return p.Vector.Pop().(int) }
 
 
 // AppendVector appends the entire IntVector x to the end of this vector.
@@ -95,9 +81,7 @@ func (p *IntVector) AppendVector(x *IntVector) {
 
 // sort.Interface support
 // Less returns a boolean denoting whether the i'th element is less than the j'th element.
-func (p *IntVector) Less(i, j int) bool {
-       return p.At(i) < p.At(j);
-}
+func (p *IntVector) Less(i, j int) bool        { return p.At(i) < p.At(j) }
 
 
 // Iterate over all elements; driver for range
index 4e54ea85c481d777a411a975fb6628bf9f0a94b8..c3f31f046ed5bcaba9e478d30f9435c459c99290 100644 (file)
@@ -20,27 +20,19 @@ func (p *StringVector) Init(len int) *StringVector {
 
 
 // NewStringVector returns an initialized new StringVector with length at least len.
-func NewStringVector(len int) *StringVector {
-       return new(StringVector).Init(len);
-}
+func NewStringVector(len int) *StringVector    { return new(StringVector).Init(len) }
 
 
 // At returns the i'th element of the vector.
-func (p *StringVector) At(i int) string {
-       return p.Vector.At(i).(string);
-}
+func (p *StringVector) At(i int) string        { return p.Vector.At(i).(string) }
 
 
 // Set sets the i'th element of the vector to value x.
-func (p *StringVector) Set(i int, x string) {
-       p.a[i] = x;
-}
+func (p *StringVector) Set(i int, x string)    { p.a[i] = x }
 
 
 // Last returns the element in the vector of highest index.
-func (p *StringVector) Last() string {
-       return p.Vector.Last().(string);
-}
+func (p *StringVector) Last() string   { return p.Vector.Last().(string) }
 
 
 // Data returns all the elements as a slice.
@@ -75,15 +67,11 @@ func (p *StringVector) Slice(i, j int) *StringVector {
 
 
 // Push appends x to the end of the vector.
-func (p *StringVector) Push(x string) {
-       p.Vector.Push(x);
-}
+func (p *StringVector) Push(x string)  { p.Vector.Push(x) }
 
 
 // Pop deletes and returns the last element of the vector.
-func (p *StringVector) Pop() string {
-       return p.Vector.Pop().(string);
-}
+func (p *StringVector) Pop() string    { return p.Vector.Pop().(string) }
 
 
 // AppendVector appends the entire StringVector x to the end of this vector.
@@ -94,9 +82,7 @@ func (p *StringVector) AppendVector(x *StringVector) {
 
 // sort.Interface support
 // Less returns a boolean denoting whether the i'th element is less than the j'th element.
-func (p *StringVector) Less(i, j int) bool {
-       return p.At(i) < p.At(j);
-}
+func (p *StringVector) Less(i, j int) bool     { return p.At(i) < p.At(j) }
 
 
 // Iterate over all elements; driver for range
index 3746b422a7b90075f9c65788e1805f9747d203a3..ee19997fb78e45e820c35d105724c5ec980d2c20 100644 (file)
@@ -79,9 +79,7 @@ func (p *Vector) Init(initial_len int) *Vector {
 
 
 // New returns an initialized new Vector with length at least len.
-func New(len int) *Vector {
-       return new(Vector).Init(len);
-}
+func New(len int) *Vector      { return new(Vector).Init(len) }
 
 
 // Len returns the number of elements in the vector.
@@ -95,21 +93,15 @@ func (p *Vector) Len() int {
 
 
 // At returns the i'th element of the vector.
-func (p *Vector) At(i int) Element {
-       return p.a[i];
-}
+func (p *Vector) At(i int) Element     { return p.a[i] }
 
 
 // Set sets the i'th element of the vector to value x.
-func (p *Vector) Set(i int, x Element) {
-       p.a[i] = x;
-}
+func (p *Vector) Set(i int, x Element) { p.a[i] = x }
 
 
 // Last returns the element in the vector of highest index.
-func (p *Vector) Last() Element {
-       return p.a[len(p.a)-1];
-}
+func (p *Vector) Last() Element        { return p.a[len(p.a)-1] }
 
 
 // Data returns all the elements as a slice.
@@ -186,9 +178,7 @@ func (p *Vector) Do(f func(elem Element)) {
 // Convenience wrappers
 
 // Push appends x to the end of the vector.
-func (p *Vector) Push(x Element) {
-       p.Insert(len(p.a), x);
-}
+func (p *Vector) Push(x Element)       { p.Insert(len(p.a), x) }
 
 
 // Pop deletes the last element of the vector.
@@ -202,9 +192,7 @@ func (p *Vector) Pop() Element {
 
 
 // AppendVector appends the entire Vector x to the end of this vector.
-func (p *Vector) AppendVector(x *Vector) {
-       p.InsertVector(len(p.a), x);
-}
+func (p *Vector) AppendVector(x *Vector)       { p.InsertVector(len(p.a), x) }
 
 
 // Partial sort.Interface support
@@ -216,9 +204,7 @@ type LessInterface interface {
 
 
 // Less returns a boolean denoting whether the i'th element is less than the j'th element.
-func (p *Vector) Less(i, j int) bool {
-       return p.a[i].(LessInterface).Less(p.a[j]);
-}
+func (p *Vector) Less(i, j int) bool   { return p.a[i].(LessInterface).Less(p.a[j]) }
 
 
 // Swap exchanges the elements at indexes i and j.
index 32a21f3eb688ee2c74b8a32afa896bd67a56923e..12a8aa07710ced914a03949159ba7d7cfa09ec00 100644 (file)
@@ -48,9 +48,7 @@ func TestNew(t *testing.T) {
 }
 
 
-func val(i int) int {
-       return i*991 - 1234;
-}
+func val(i int) int    { return i*991 - 1234 }
 
 
 func TestAccess(t *testing.T) {
index 738deba66317dcb8d4279dc86ac269f6d9564ac6..9699830195c8ecce29a19b3f1aa4af02c20ecdac 100644 (file)
@@ -135,9 +135,7 @@ func subw(w uint32) uint32 {
 }
 
 // Rotate
-func rotw(w uint32) uint32 {
-       return w<<8 | w>>24;
-}
+func rotw(w uint32) uint32     { return w<<8 | w>>24 }
 
 // Key expansion algorithm.  See FIPS-197, Figure 11.
 // Their rcon[i] is our powx[i-1] << 24.
index db9b59cd0e77d14caad95442e3f05450e9f3ca6e..41127254915bba69af2cc38d2071932b2b162e58 100644 (file)
@@ -46,24 +46,18 @@ func NewCipher(key []byte) (*Cipher, os.Error) {
 // BlockSize returns the AES block size, 16 bytes.
 // It is necessary to satisfy the Key interface in the
 // package "crypto/modes".
-func (c *Cipher) BlockSize() int {
-       return BlockSize;
-}
+func (c *Cipher) BlockSize() int       { return BlockSize }
 
 // Encrypt encrypts the 16-byte buffer src using the key k
 // and stores the result in dst.
 // Note that for amounts of data larger than a block,
 // it is not safe to just call Encrypt on successive blocks;
 // instead, use an encryption mode like AESCBC (see modes.go).
-func (c *Cipher) Encrypt(src, dst []byte) {
-       encryptBlock(c.enc, src, dst);
-}
+func (c *Cipher) Encrypt(src, dst []byte)      { encryptBlock(c.enc, src, dst) }
 
 // Decrypt decrypts the 16-byte buffer src using the key k
 // and stores the result in dst.
-func (c *Cipher) Decrypt(src, dst []byte) {
-       decryptBlock(c.dec, src, dst);
-}
+func (c *Cipher) Decrypt(src, dst []byte)      { decryptBlock(c.dec, src, dst) }
 
 // Reset zeros the key data, so that it will no longer
 // appear in the process's memory.
index 7bdf7d3049b9850f0f9685a7808ae2d831f30c85..47aa8f32d9e0aedb6869fa0550019cd934aed948 100644 (file)
@@ -32,9 +32,7 @@ func newCBC(c Cipher, iv []byte) *cbcCipher {
        return x;
 }
 
-func (x *cbcCipher) BlockSize() int {
-       return x.blockSize;
-}
+func (x *cbcCipher) BlockSize() int    { return x.blockSize }
 
 func (x *cbcCipher) Encrypt(src, dst []byte) {
        for i := 0; i < x.blockSize; i++ {
index 412381605fdd41fb760e6010793735e0e867b44d..f515bdcfd66e5ac25bbcd35e34be7e06239a9f21 100644 (file)
@@ -38,9 +38,7 @@ func newCFB(c Cipher, s int, iv []byte) *cfbCipher {
        return x;
 }
 
-func (x *cfbCipher) BlockSize() int {
-       return x.blockSize;
-}
+func (x *cfbCipher) BlockSize() int    { return x.blockSize }
 
 func (x *cfbCipher) Encrypt(src, dst []byte) {
        // Encrypt old IV and xor prefix with src to make dst.
index 667dc7b3e5085dc9bbd1a0ecbea8687ad54652b5..f57e64174673e2b21af6fcef7ac392cf601aac2d 100644 (file)
@@ -102,6 +102,4 @@ func (d *cmac) Sum() []byte {
        return d.digest;
 }
 
-func (d *cmac) Size() int {
-       return len(d.digest);
-}
+func (d *cmac) Size() int      { return len(d.digest) }
index 664c4f4e10cd9b343a3706c7f637d9601343e903..c6507220bf8fcb8dd3ff678c1f6c8ea2162db201 100644 (file)
@@ -20,9 +20,7 @@ type IncCipher struct {
        encrypting      bool;
 }
 
-func (c *IncCipher) BlockSize() int {
-       return c.blockSize;
-}
+func (c *IncCipher) BlockSize() int    { return c.blockSize }
 
 func (c *IncCipher) Encrypt(src, dst []byte) {
        if !c.encrypting {
index 4ed5686d703335ae6885f964f4860688c20cf811..f1cc6b32a2c40464583b303f31f7ac9b364184a0 100644 (file)
@@ -64,9 +64,7 @@ func (h *hmac) Write(p []byte) (n int, err os.Error) {
        return h.inner.Write(p);
 }
 
-func (h *hmac) Size() int {
-       return h.size;
-}
+func (h *hmac) Size() int      { return h.size }
 
 func (h *hmac) Reset() {
        h.inner.Reset();
@@ -94,11 +92,7 @@ func New(h hash.Hash, key []byte) hash.Hash {
 }
 
 // NewMD5 returns a new HMAC-MD5 hash using the given key.
-func NewMD5(key []byte) hash.Hash {
-       return New(md5.New(), key);
-}
+func NewMD5(key []byte) hash.Hash      { return New(md5.New(), key) }
 
 // NewSHA1 returns a new HMAC-SHA1 hash using the given key.
-func NewSHA1(key []byte) hash.Hash {
-       return New(sha1.New(), key);
-}
+func NewSHA1(key []byte) hash.Hash     { return New(sha1.New(), key) }
index 77b3319c01828b013cd1bbd127599a9645abdb13..4236ad3fa0889d4595abb5aa28965696f7edd0b8 100644 (file)
@@ -45,9 +45,7 @@ func New() hash.Hash {
        return d;
 }
 
-func (d *digest) Size() int {
-       return Size;
-}
+func (d *digest) Size() int    { return Size }
 
 func (d *digest) Write(p []byte) (nn int, err os.Error) {
        nn = len(p);
index 685efd18fe26efcc98885a005df57bbdcd720ffe..beb41629733219578fbcc053f7ca6f21af4c4dbd 100644 (file)
@@ -296,9 +296,7 @@ func EncryptOAEP(hash hash.Hash, rand io.Reader, pub *PublicKey, msg []byte, lab
 // It is deliberately vague to avoid adaptive attacks.
 type DecryptionError struct{}
 
-func (DecryptionError) String() string {
-       return "RSA decryption error";
-}
+func (DecryptionError) String() string { return "RSA decryption error" }
 
 // modInverse returns ia, the inverse of a in the multiplicative group of prime
 // order n. It requires that a be a member of the group (i.e. less than n).
index a278f04ebea3e75e81eef280dac1ee5e1d093416..4e75b7336bad6f1ce03bf34fac8696a0313b86ee 100644 (file)
@@ -47,9 +47,7 @@ func New() hash.Hash {
        return d;
 }
 
-func (d *digest) Size() int {
-       return Size;
-}
+func (d *digest) Size() int    { return Size }
 
 func (d *digest) Write(p []byte) (nn int, err os.Error) {
        nn = len(p);
index a1d2eaf998b9febdc2b985db6470b1881d51bd95..4dd7aa0423a1e2eefadbf938db61e047527f7675 100644 (file)
@@ -21,9 +21,7 @@ func ConstantTimeCompare(x, y []byte) int {
 
 // ConstantTimeSelect returns x if v is 1 and y if v is 0.
 // Its behavior is undefined if v takes any other value.
-func ConstantTimeSelect(v, x, y int) int {
-       return ^(v-1) & x | (v-1)&y;
-}
+func ConstantTimeSelect(v, x, y int) int       { return ^(v-1) & x | (v-1)&y }
 
 // ConstantTimeByteEq returns 1 if x == x and 0 otherwise.
 func ConstantTimeByteEq(x, y uint8) int {
index 2145b7b55648b16316ddfa73d27e2d3881e18c29..36ad640cd61e463ae651dc4950b2728cfc571a48 100644 (file)
@@ -106,20 +106,12 @@ func mutualVersion(theirMajor, theirMinor uint8) (major, minor uint8, ok bool) {
 // A nop implements the NULL encryption and MAC algorithms.
 type nop struct{}
 
-func (nop) XORKeyStream(buf []byte) {
-}
+func (nop) XORKeyStream(buf []byte)    {}
 
-func (nop) Write(buf []byte) (int, os.Error) {
-       return len(buf), nil;
-}
+func (nop) Write(buf []byte) (int, os.Error)   { return len(buf), nil }
 
-func (nop) Sum() []byte {
-       return nil;
-}
+func (nop) Sum() []byte        { return nil }
 
-func (nop) Reset() {
-}
+func (nop) Reset()     {}
 
-func (nop) Size() int {
-       return 0;
-}
+func (nop) Size() int  { return 0 }
index 13d8fd70b0ec3ecb2b5bc00bbf467f242cfec496..c20e24e55c6fa2bf56f9d3a0e751dc62280cddd3 100644 (file)
@@ -155,13 +155,9 @@ func (l Listener) Accept() (c net.Conn, err os.Error) {
        return;
 }
 
-func (l Listener) Close() os.Error {
-       return l.listener.Close();
-}
+func (l Listener) Close() os.Error     { return l.listener.Close() }
 
-func (l Listener) Addr() net.Addr {
-       return l.listener.Addr();
-}
+func (l Listener) Addr() net.Addr      { return l.listener.Addr() }
 
 // NewListener creates a Listener which accepts connections from an inner
 // Listener and wraps each connection with Server.
index 34880a5d5f585ed57d625cf659d0e138c289bb77..87576e65cef6e8942bd6ba1d21dd3c284cd712d3 100644 (file)
@@ -49,9 +49,7 @@ func (b *buf) bytes(n int) []byte {
        return data;
 }
 
-func (b *buf) skip(n int) {
-       b.bytes(n);
-}
+func (b *buf) skip(n int)      { b.bytes(n) }
 
 func (b *buf) string() string {
        for i := 0; i < len(b.data); i++ {
index 91334bdf29ae7f2476e0229de9f870687cb2f035..77d24f5d27373076d3b3e18ca93d79637f4b2bc1 100644 (file)
@@ -29,13 +29,9 @@ type CommonType struct {
        Name            string; // name that can be used to refer to type
 }
 
-func (c *CommonType) Common() *CommonType {
-       return c;
-}
+func (c *CommonType) Common() *CommonType      { return c }
 
-func (c *CommonType) Size() int64 {
-       return c.ByteSize;
-}
+func (c *CommonType) Size() int64      { return c.ByteSize }
 
 // Basic types
 
@@ -46,9 +42,7 @@ type BasicType struct {
        BitOffset       int64;
 }
 
-func (b *BasicType) Basic() *BasicType {
-       return b;
-}
+func (b *BasicType) Basic() *BasicType { return b }
 
 func (t *BasicType) String() string {
        if t.Name != "" {
@@ -106,13 +100,9 @@ type QualType struct {
        Type    Type;
 }
 
-func (t *QualType) String() string {
-       return t.Qual + " " + t.Type.String();
-}
+func (t *QualType) String() string     { return t.Qual + " " + t.Type.String() }
 
-func (t *QualType) Size() int64 {
-       return t.Type.Size();
-}
+func (t *QualType) Size() int64        { return t.Type.Size() }
 
 // An ArrayType represents a fixed size array type.
 type ArrayType struct {
@@ -126,18 +116,14 @@ func (t *ArrayType) String() string {
        return "[" + strconv.Itoa64(t.Count) + "]" + t.Type.String();
 }
 
-func (t *ArrayType) Size() int64 {
-       return t.Count * t.Type.Size();
-}
+func (t *ArrayType) Size() int64       { return t.Count * t.Type.Size() }
 
 // A VoidType represents the C void type.
 type VoidType struct {
        CommonType;
 }
 
-func (t *VoidType) String() string {
-       return "void";
-}
+func (t *VoidType) String() string     { return "void" }
 
 // A PtrType represents a pointer type.
 type PtrType struct {
@@ -145,9 +131,7 @@ type PtrType struct {
        Type    Type;
 }
 
-func (t *PtrType) String() string {
-       return "*" + t.Type.String();
-}
+func (t *PtrType) String() string      { return "*" + t.Type.String() }
 
 // A StructType represents a struct, union, or C++ class type.
 type StructType struct {
@@ -258,9 +242,7 @@ type DotDotDotType struct {
        CommonType;
 }
 
-func (t *DotDotDotType) String() string {
-       return "...";
-}
+func (t *DotDotDotType) String() string        { return "..." }
 
 // A TypedefType represents a named type.
 type TypedefType struct {
@@ -268,13 +250,9 @@ type TypedefType struct {
        Type    Type;
 }
 
-func (t *TypedefType) String() string {
-       return t.Name;
-}
+func (t *TypedefType) String() string  { return t.Name }
 
-func (t *TypedefType) Size() int64 {
-       return t.Type.Size();
-}
+func (t *TypedefType) Size() int64     { return t.Type.Size() }
 
 func (d *Data) Type(off Offset) (Type, os.Error) {
        if t, ok := d.typeCache[off]; ok {
index 98e444eaf2bfa1c54bbfc797e74386f602e43444..dcecbe2c3e2ee83fb2231bd1997083e2a67da4f0 100644 (file)
@@ -56,9 +56,7 @@ func machoData(t *testing.T, name string) *Data {
 }
 
 
-func TestTypedefsELF(t *testing.T) {
-       testTypedefs(t, elfData(t, "testdata/typedef.elf"));
-}
+func TestTypedefsELF(t *testing.T)     { testTypedefs(t, elfData(t, "testdata/typedef.elf")) }
 
 func TestTypedefsMachO(t *testing.T) {
        testTypedefs(t, machoData(t, "testdata/typedef.macho"));
index 716f10b40bfca7b99c1adb06ee6ff8870846053f..42a240efd7cc1966b9c841761a37e6b30d4b7bf9 100644 (file)
@@ -73,12 +73,8 @@ var versionStrings = []intName{
        intName{1, "EV_CURRENT"},
 }
 
-func (i Version) String() string {
-       return stringName(uint32(i), versionStrings, false);
-}
-func (i Version) GoString() string {
-       return stringName(uint32(i), versionStrings, true);
-}
+func (i Version) String() string       { return stringName(uint32(i), versionStrings, false) }
+func (i Version) GoString() string     { return stringName(uint32(i), versionStrings, true) }
 
 // Class is found in Header.Ident[EI_CLASS] and Header.Class.
 type Class byte
@@ -95,12 +91,8 @@ var classStrings = []intName{
        intName{2, "ELFCLASS64"},
 }
 
-func (i Class) String() string {
-       return stringName(uint32(i), classStrings, false);
-}
-func (i Class) GoString() string {
-       return stringName(uint32(i), classStrings, true);
-}
+func (i Class) String() string         { return stringName(uint32(i), classStrings, false) }
+func (i Class) GoString() string       { return stringName(uint32(i), classStrings, true) }
 
 // Data is found in Header.Ident[EI_DATA] and Header.Data.
 type Data byte
@@ -117,12 +109,8 @@ var dataStrings = []intName{
        intName{2, "ELFDATA2MSB"},
 }
 
-func (i Data) String() string {
-       return stringName(uint32(i), dataStrings, false);
-}
-func (i Data) GoString() string {
-       return stringName(uint32(i), dataStrings, true);
-}
+func (i Data) String() string  { return stringName(uint32(i), dataStrings, false) }
+func (i Data) GoString() string        { return stringName(uint32(i), dataStrings, true) }
 
 // OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI.
 type OSABI byte
@@ -167,12 +155,8 @@ var osabiStrings = []intName{
        intName{255, "ELFOSABI_STANDALONE"},
 }
 
-func (i OSABI) String() string {
-       return stringName(uint32(i), osabiStrings, false);
-}
-func (i OSABI) GoString() string {
-       return stringName(uint32(i), osabiStrings, true);
-}
+func (i OSABI) String() string         { return stringName(uint32(i), osabiStrings, false) }
+func (i OSABI) GoString() string       { return stringName(uint32(i), osabiStrings, true) }
 
 // Type is found in Header.Type.
 type Type uint16
@@ -201,12 +185,8 @@ var typeStrings = []intName{
        intName{0xffff, "ET_HIPROC"},
 }
 
-func (i Type) String() string {
-       return stringName(uint32(i), typeStrings, false);
-}
-func (i Type) GoString() string {
-       return stringName(uint32(i), typeStrings, true);
-}
+func (i Type) String() string  { return stringName(uint32(i), typeStrings, false) }
+func (i Type) GoString() string        { return stringName(uint32(i), typeStrings, true) }
 
 // Machine is found in Header.Machine.
 type Machine uint16
@@ -315,12 +295,8 @@ var machineStrings = []intName{
        intName{0x9026, "EM_ALPHA"},
 }
 
-func (i Machine) String() string {
-       return stringName(uint32(i), machineStrings, false);
-}
-func (i Machine) GoString() string {
-       return stringName(uint32(i), machineStrings, true);
-}
+func (i Machine) String() string       { return stringName(uint32(i), machineStrings, false) }
+func (i Machine) GoString() string     { return stringName(uint32(i), machineStrings, true) }
 
 // Special section indices.
 type SectionIndex int
@@ -347,12 +323,8 @@ var shnStrings = []intName{
        intName{0xffff, "SHN_XINDEX"},
 }
 
-func (i SectionIndex) String() string {
-       return stringName(uint32(i), shnStrings, false);
-}
-func (i SectionIndex) GoString() string {
-       return stringName(uint32(i), shnStrings, true);
-}
+func (i SectionIndex) String() string  { return stringName(uint32(i), shnStrings, false) }
+func (i SectionIndex) GoString() string        { return stringName(uint32(i), shnStrings, true) }
 
 // Section type.
 type SectionType uint32
@@ -409,12 +381,8 @@ var shtStrings = []intName{
        intName{0xffffffff, "SHT_HIUSER"},
 }
 
-func (i SectionType) String() string {
-       return stringName(uint32(i), shtStrings, false);
-}
-func (i SectionType) GoString() string {
-       return stringName(uint32(i), shtStrings, true);
-}
+func (i SectionType) String() string   { return stringName(uint32(i), shtStrings, false) }
+func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) }
 
 // Section flags.
 type SectionFlag uint32
@@ -447,12 +415,8 @@ var shfStrings = []intName{
        intName{0x400, "SHF_TLS"},
 }
 
-func (i SectionFlag) String() string {
-       return flagName(uint32(i), shfStrings, false);
-}
-func (i SectionFlag) GoString() string {
-       return flagName(uint32(i), shfStrings, true);
-}
+func (i SectionFlag) String() string   { return flagName(uint32(i), shfStrings, false) }
+func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) }
 
 // Prog.Type
 type ProgType int
@@ -487,12 +451,8 @@ var ptStrings = []intName{
        intName{0x7fffffff, "PT_HIPROC"},
 }
 
-func (i ProgType) String() string {
-       return stringName(uint32(i), ptStrings, false);
-}
-func (i ProgType) GoString() string {
-       return stringName(uint32(i), ptStrings, true);
-}
+func (i ProgType) String() string      { return stringName(uint32(i), ptStrings, false) }
+func (i ProgType) GoString() string    { return stringName(uint32(i), ptStrings, true) }
 
 // Prog.Flag
 type ProgFlag uint32
@@ -511,12 +471,8 @@ var pfStrings = []intName{
        intName{0x4, "PF_R"},
 }
 
-func (i ProgFlag) String() string {
-       return flagName(uint32(i), pfStrings, false);
-}
-func (i ProgFlag) GoString() string {
-       return flagName(uint32(i), pfStrings, true);
-}
+func (i ProgFlag) String() string      { return flagName(uint32(i), pfStrings, false) }
+func (i ProgFlag) GoString() string    { return flagName(uint32(i), pfStrings, true) }
 
 // Dyn.Tag
 type DynTag int
@@ -607,12 +563,8 @@ var dtStrings = []intName{
        intName{0x7fffffff, "DT_HIPROC"},
 }
 
-func (i DynTag) String() string {
-       return stringName(uint32(i), dtStrings, false);
-}
-func (i DynTag) GoString() string {
-       return stringName(uint32(i), dtStrings, true);
-}
+func (i DynTag) String() string                { return stringName(uint32(i), dtStrings, false) }
+func (i DynTag) GoString() string      { return stringName(uint32(i), dtStrings, true) }
 
 // DT_FLAGS values.
 type DynFlag int
@@ -640,12 +592,8 @@ var dflagStrings = []intName{
        intName{0x0010, "DF_STATIC_TLS"},
 }
 
-func (i DynFlag) String() string {
-       return flagName(uint32(i), dflagStrings, false);
-}
-func (i DynFlag) GoString() string {
-       return flagName(uint32(i), dflagStrings, true);
-}
+func (i DynFlag) String() string       { return flagName(uint32(i), dflagStrings, false) }
+func (i DynFlag) GoString() string     { return flagName(uint32(i), dflagStrings, true) }
 
 // NType values; used in core files.
 type NType int
@@ -662,12 +610,8 @@ var ntypeStrings = []intName{
        intName{3, "NT_PRPSINFO"},
 }
 
-func (i NType) String() string {
-       return stringName(uint32(i), ntypeStrings, false);
-}
-func (i NType) GoString() string {
-       return stringName(uint32(i), ntypeStrings, true);
-}
+func (i NType) String() string         { return stringName(uint32(i), ntypeStrings, false) }
+func (i NType) GoString() string       { return stringName(uint32(i), ntypeStrings, true) }
 
 /* Symbol Binding - ELFNN_ST_BIND - st_info */
 type SymBind int
@@ -692,12 +636,8 @@ var stbStrings = []intName{
        intName{15, "STB_HIPROC"},
 }
 
-func (i SymBind) String() string {
-       return stringName(uint32(i), stbStrings, false);
-}
-func (i SymBind) GoString() string {
-       return stringName(uint32(i), stbStrings, true);
-}
+func (i SymBind) String() string       { return stringName(uint32(i), stbStrings, false) }
+func (i SymBind) GoString() string     { return stringName(uint32(i), stbStrings, true) }
 
 /* Symbol type - ELFNN_ST_TYPE - st_info */
 type SymType int
@@ -730,12 +670,8 @@ var sttStrings = []intName{
        intName{15, "STT_HIPROC"},
 }
 
-func (i SymType) String() string {
-       return stringName(uint32(i), sttStrings, false);
-}
-func (i SymType) GoString() string {
-       return stringName(uint32(i), sttStrings, true);
-}
+func (i SymType) String() string       { return stringName(uint32(i), sttStrings, false) }
+func (i SymType) GoString() string     { return stringName(uint32(i), sttStrings, true) }
 
 /* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
 type SymVis int
@@ -754,12 +690,8 @@ var stvStrings = []intName{
        intName{0x3, "STV_PROTECTED"},
 }
 
-func (i SymVis) String() string {
-       return stringName(uint32(i), stvStrings, false);
-}
-func (i SymVis) GoString() string {
-       return stringName(uint32(i), stvStrings, true);
-}
+func (i SymVis) String() string                { return stringName(uint32(i), stvStrings, false) }
+func (i SymVis) GoString() string      { return stringName(uint32(i), stvStrings, true) }
 
 /*
  * Relocation types.
@@ -822,12 +754,8 @@ var rx86_64Strings = []intName{
        intName{23, "R_X86_64_TPOFF32"},
 }
 
-func (i R_X86_64) String() string {
-       return stringName(uint32(i), rx86_64Strings, false);
-}
-func (i R_X86_64) GoString() string {
-       return stringName(uint32(i), rx86_64Strings, true);
-}
+func (i R_X86_64) String() string      { return stringName(uint32(i), rx86_64Strings, false) }
+func (i R_X86_64) GoString() string    { return stringName(uint32(i), rx86_64Strings, true) }
 
 // Relocation types for Alpha.
 type R_ALPHA int
@@ -894,12 +822,8 @@ var ralphaStrings = []intName{
        intName{27, "R_ALPHA_RELATIVE"},
 }
 
-func (i R_ALPHA) String() string {
-       return stringName(uint32(i), ralphaStrings, false);
-}
-func (i R_ALPHA) GoString() string {
-       return stringName(uint32(i), ralphaStrings, true);
-}
+func (i R_ALPHA) String() string       { return stringName(uint32(i), ralphaStrings, false) }
+func (i R_ALPHA) GoString() string     { return stringName(uint32(i), ralphaStrings, true) }
 
 // Relocation types for ARM.
 type R_ARM int
@@ -976,12 +900,8 @@ var rarmStrings = []intName{
        intName{255, "R_ARM_RBASE"},
 }
 
-func (i R_ARM) String() string {
-       return stringName(uint32(i), rarmStrings, false);
-}
-func (i R_ARM) GoString() string {
-       return stringName(uint32(i), rarmStrings, true);
-}
+func (i R_ARM) String() string         { return stringName(uint32(i), rarmStrings, false) }
+func (i R_ARM) GoString() string       { return stringName(uint32(i), rarmStrings, true) }
 
 // Relocation types for 386.
 type R_386 int
@@ -1054,12 +974,8 @@ var r386Strings = []intName{
        intName{37, "R_386_TLS_TPOFF32"},
 }
 
-func (i R_386) String() string {
-       return stringName(uint32(i), r386Strings, false);
-}
-func (i R_386) GoString() string {
-       return stringName(uint32(i), r386Strings, true);
-}
+func (i R_386) String() string         { return stringName(uint32(i), r386Strings, false) }
+func (i R_386) GoString() string       { return stringName(uint32(i), r386Strings, true) }
 
 // Relocation types for PowerPC.
 type R_PPC int
@@ -1226,12 +1142,8 @@ var rppcStrings = []intName{
        intName{116, "R_PPC_EMB_RELSDA"},
 }
 
-func (i R_PPC) String() string {
-       return stringName(uint32(i), rppcStrings, false);
-}
-func (i R_PPC) GoString() string {
-       return stringName(uint32(i), rppcStrings, true);
-}
+func (i R_PPC) String() string         { return stringName(uint32(i), rppcStrings, false) }
+func (i R_PPC) GoString() string       { return stringName(uint32(i), rppcStrings, true) }
 
 // Relocation types for SPARC.
 type R_SPARC int
@@ -1354,12 +1266,8 @@ var rsparcStrings = []intName{
        intName{55, "R_SPARC_UA16"},
 }
 
-func (i R_SPARC) String() string {
-       return stringName(uint32(i), rsparcStrings, false);
-}
-func (i R_SPARC) GoString() string {
-       return stringName(uint32(i), rsparcStrings, true);
-}
+func (i R_SPARC) String() string       { return stringName(uint32(i), rsparcStrings, false) }
+func (i R_SPARC) GoString() string     { return stringName(uint32(i), rsparcStrings, true) }
 
 /*
  * Magic number for the elf trampoline, chosen wisely to be an immediate
@@ -1443,15 +1351,9 @@ type Rela32 struct {
        Addend  int32;  /* Addend. */
 }
 
-func R_SYM32(info uint32) uint32 {
-       return uint32(info>>8);
-}
-func R_TYPE32(info uint32) uint32 {
-       return uint32(info&0xff);
-}
-func R_INFO32(sym, typ uint32) uint32 {
-       return sym<<8 | typ;
-}
+func R_SYM32(info uint32) uint32       { return uint32(info>>8) }
+func R_TYPE32(info uint32) uint32      { return uint32(info&0xff) }
+func R_INFO32(sym, typ uint32) uint32  { return sym<<8 | typ }
 
 // ELF32 Symbol.
 type Sym32 struct {
@@ -1465,15 +1367,9 @@ type Sym32 struct {
 
 const Sym32Size = 16
 
-func ST_BIND(info uint8) SymBind {
-       return SymBind(info>>4);
-}
-func ST_TYPE(bind SymBind, typ SymType) uint8 {
-       return uint8(bind)<<4 | uint8(typ)&0xf;
-}
-func ST_VISIBILITY(other uint8) SymVis {
-       return SymVis(other&3);
-}
+func ST_BIND(info uint8) SymBind               { return SymBind(info>>4) }
+func ST_TYPE(bind SymBind, typ SymType) uint8  { return uint8(bind)<<4 | uint8(typ)&0xf }
+func ST_VISIBILITY(other uint8) SymVis         { return SymVis(other&3) }
 
 /*
  * ELF64
@@ -1558,15 +1454,9 @@ type Rela64 struct {
        Addend  int64;  /* Addend. */
 }
 
-func R_SYM64(info uint64) uint32 {
-       return uint32(info>>32);
-}
-func R_TYPE64(info uint64) uint32 {
-       return uint32(info);
-}
-func R_INFO(sym, typ uint32) uint64 {
-       return uint64(sym)<<32 | uint64(typ);
-}
+func R_SYM64(info uint64) uint32       { return uint32(info>>32) }
+func R_TYPE64(info uint64) uint32      { return uint32(info) }
+func R_INFO(sym, typ uint32) uint64    { return uint64(sym)<<32 | uint64(typ) }
 
 
 /*
index 0945eb506fdaef2eef0110a1a4dc1d696c890ae4..c51f9bd16dea010c2ebc0176966a1dbadd77f451 100644 (file)
@@ -76,9 +76,7 @@ func (s *Section) Data() ([]byte, os.Error) {
 }
 
 // Open returns a new ReadSeeker reading the ELF section.
-func (s *Section) Open() io.ReadSeeker {
-       return io.NewSectionReader(s.sr, 0, 1<<63 - 1);
-}
+func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63 - 1) }
 
 // A ProgHeader represents a single ELF program header.
 type ProgHeader struct {
@@ -106,9 +104,7 @@ type Prog struct {
 }
 
 // Open returns a new ReadSeeker reading the ELF program body.
-func (p *Prog) Open() io.ReadSeeker {
-       return io.NewSectionReader(p.sr, 0, 1<<63 - 1);
-}
+func (p *Prog) Open() io.ReadSeeker    { return io.NewSectionReader(p.sr, 0, 1<<63 - 1) }
 
 // A Symbol represents an entry in an ELF symbol table section.
 type Symbol struct {
index 153465ae45fe011c9a7b12abc0b0e876a7301117..cb9b1f4eb1517474399eaebb2bbe8de9271b3362 100644 (file)
@@ -35,9 +35,7 @@ type Sym struct {
 }
 
 // Static returns whether this symbol is static (not visible outside its file).
-func (s *Sym) Static() bool {
-       return s.Type >= 'a';
-}
+func (s *Sym) Static() bool    { return s.Type >= 'a' }
 
 // PackageName returns the package part of the symbol name,
 // or the empty string if there is none.
@@ -518,9 +516,7 @@ func (o *Obj) alineFromLine(path string, line int) (int, os.Error) {
 // the symbol table.
 type UnknownFileError string
 
-func (e UnknownFileError) String() string {
-       return "unknown file: " + string(e);
-}
+func (e UnknownFileError) String() string      { return "unknown file: " + string(e) }
 
 // UnknownLineError represents a failure to map a line to a program
 // counter, either because the line is beyond the bounds of the file
index 3561e03fde9ae59e644b09635cdf8a869ba49997..52ba94fd74f236dbe84be12e279b836ecfa40482 100644 (file)
@@ -35,9 +35,7 @@ type Load interface {
 // A LoadBytes is the uninterpreted bytes of a Mach-O load command.
 type LoadBytes []byte
 
-func (b LoadBytes) Raw() []byte {
-       return b;
-}
+func (b LoadBytes) Raw() []byte        { return b }
 
 // A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command.
 type SegmentHeader struct {
@@ -77,9 +75,7 @@ func (s *Segment) Data() ([]byte, os.Error) {
 }
 
 // Open returns a new ReadSeeker reading the segment.
-func (s *Segment) Open() io.ReadSeeker {
-       return io.NewSectionReader(s.sr, 0, 1<<63 - 1);
-}
+func (s *Segment) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63 - 1) }
 
 type SectionHeader struct {
        Name    string;
@@ -114,9 +110,7 @@ func (s *Section) Data() ([]byte, os.Error) {
 }
 
 // Open returns a new ReadSeeker reading the Mach-O section.
-func (s *Section) Open() io.ReadSeeker {
-       return io.NewSectionReader(s.sr, 0, 1<<63 - 1);
-}
+func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63 - 1) }
 
 
 /*
index 4903f13450b8ba54994b6d0fd65e54c677dce844..d8fbba376bc1d290d0e478168107b0a159a547fc 100644 (file)
@@ -51,12 +51,8 @@ var cpuStrings = []intName{
        intName{uint32(CpuAmd64), "CpuAmd64"},
 }
 
-func (i Cpu) String() string {
-       return stringName(uint32(i), cpuStrings, false);
-}
-func (i Cpu) GoString() string {
-       return stringName(uint32(i), cpuStrings, true);
-}
+func (i Cpu) String() string   { return stringName(uint32(i), cpuStrings, false) }
+func (i Cpu) GoString() string { return stringName(uint32(i), cpuStrings, true) }
 
 // A LoadCmd is a Mach-O load command.
 type LoadCmd uint32
@@ -75,12 +71,8 @@ var cmdStrings = []intName{
        intName{uint32(LoadCmdUnixThread), "LoadCmdUnixThread"},
 }
 
-func (i LoadCmd) String() string {
-       return stringName(uint32(i), cmdStrings, false);
-}
-func (i LoadCmd) GoString() string {
-       return stringName(uint32(i), cmdStrings, true);
-}
+func (i LoadCmd) String() string       { return stringName(uint32(i), cmdStrings, false) }
+func (i LoadCmd) GoString() string     { return stringName(uint32(i), cmdStrings, true) }
 
 // A Segment64 is a 64-bit Mach-O segment load command.
 type Segment64 struct {
index 084228b24e3741487ed458bdb4f930ddc51781fc..0719ebef3ec83e6a7c6c944931613b578d18de12 100644 (file)
@@ -151,18 +151,14 @@ type Process interface {
 // stop.
 type Stopped struct{}
 
-func (c Stopped) String() string {
-       return "stopped";
-}
+func (c Stopped) String() string       { return "stopped" }
 
 // Breakpoint is a stop cause resulting from a thread reaching a set
 // breakpoint.
 type Breakpoint Word
 
 // PC returns the program counter that the program is stopped at.
-func (c Breakpoint) PC() Word {
-       return Word(c);
-}
+func (c Breakpoint) PC() Word  { return Word(c) }
 
 func (c Breakpoint) String() string {
        return "breakpoint at 0x" + strconv.Uitob64(uint64(c.PC()), 16);
@@ -173,13 +169,9 @@ func (c Breakpoint) String() string {
 type Signal string
 
 // Signal returns the signal being delivered to the thread.
-func (c Signal) Name() string {
-       return string(c);
-}
+func (c Signal) Name() string  { return string(c) }
 
-func (c Signal) String() string {
-       return c.Name();
-}
+func (c Signal) String() string        { return c.Name() }
 
 // ThreadCreate is a stop cause returned from an existing thread when
 // it creates a new thread.  The new thread exists in a primordial
@@ -189,13 +181,9 @@ type ThreadCreate struct {
        thread Thread;
 }
 
-func (c *ThreadCreate) NewThread() Thread {
-       return c.thread;
-}
+func (c *ThreadCreate) NewThread() Thread      { return c.thread }
 
-func (c *ThreadCreate) String() string {
-       return "thread create";
-}
+func (c *ThreadCreate) String() string { return "thread create" }
 
 // ThreadExit is a stop cause resulting from a thread exiting.  When
 // this cause first arises, the thread will still be in the list of
@@ -207,26 +195,18 @@ type ThreadExit struct {
 }
 
 // Exited returns true if the thread exited normally.
-func (c *ThreadExit) Exited() bool {
-       return c.exitStatus != -1;
-}
+func (c *ThreadExit) Exited() bool     { return c.exitStatus != -1 }
 
 // ExitStatus returns the exit status of the thread if it exited
 // normally or -1 otherwise.
-func (c *ThreadExit) ExitStatus() int {
-       return c.exitStatus;
-}
+func (c *ThreadExit) ExitStatus() int  { return c.exitStatus }
 
 // Signaled returns true if the thread was terminated by a signal.
-func (c *ThreadExit) Signaled() bool {
-       return c.exitStatus == -1;
-}
+func (c *ThreadExit) Signaled() bool   { return c.exitStatus == -1 }
 
 // StopSignal returns the signal that terminated the thread, or "" if
 // it was not terminated by a signal.
-func (c *ThreadExit) StopSignal() string {
-       return c.signal;
-}
+func (c *ThreadExit) StopSignal() string       { return c.signal }
 
 func (c *ThreadExit) String() string {
        res := "thread exited ";
index 60a0555e9819b5d94abd81ec39d7f656baf563b5..ac469ecad0a30397672c86d323bafbca55686616 100644 (file)
@@ -84,17 +84,11 @@ func (ts threadState) isStopped() bool {
        return ts == stopped || ts == stoppedBreakpoint || ts == stoppedSignal || ts == stoppedThreadCreate || ts == stoppedExiting;
 }
 
-func (ts threadState) isZombie() bool {
-       return ts == exiting;
-}
+func (ts threadState) isZombie() bool  { return ts == exiting }
 
-func (ts threadState) isTerminal() bool {
-       return ts == exited || ts == detached;
-}
+func (ts threadState) isTerminal() bool        { return ts == exited || ts == detached }
 
-func (ts threadState) String() string {
-       return string(ts);
-}
+func (ts threadState) String() string  { return string(ts) }
 
 /*
  * Basic types
@@ -206,9 +200,7 @@ func (e breakpointExistsError) String() string {
 
 type noBreakpointError Word
 
-func (e noBreakpointError) String() string {
-       return fmt.Sprintf("no breakpoint at PC %#x", e);
-}
+func (e noBreakpointError) String() string     { return fmt.Sprintf("no breakpoint at PC %#x", e) }
 
 type newThreadError struct {
        *os.Waitmsg;
@@ -222,9 +214,7 @@ func (e *newThreadError) String() string {
 
 type ProcessExited struct{}
 
-func (p ProcessExited) String() string {
-       return "process exited";
-}
+func (p ProcessExited) String() string { return "process exited" }
 
 /*
  * Ptrace wrappers
index 496fbc3375f975b5c901ab04aa407f1111346848..a665cd4d14dcce79042ae0d1ae1166c5599723e5 100644 (file)
@@ -34,9 +34,7 @@ var names = [...]string{
        "gs",
 }
 
-func (r *_386Regs) PC() Word {
-       return Word(r.Eip);
-}
+func (r *_386Regs) PC() Word   { return Word(r.Eip) }
 
 func (r *_386Regs) SetPC(val Word) os.Error {
        r.Eip = int32(val);
@@ -48,22 +46,16 @@ func (r *_386Regs) Link() Word {
        panic("No link register");
 }
 
-func (r *_386Regs) SetLink(val Word) os.Error {
-       panic("No link register");
-}
+func (r *_386Regs) SetLink(val Word) os.Error  { panic("No link register") }
 
-func (r *_386Regs) SP() Word {
-       return Word(r.Esp);
-}
+func (r *_386Regs) SP() Word   { return Word(r.Esp) }
 
 func (r *_386Regs) SetSP(val Word) os.Error {
        r.Esp = int32(val);
        return r.setter(&r.PtraceRegs);
 }
 
-func (r *_386Regs) Names() []string {
-       return &names;
-}
+func (r *_386Regs) Names() []string    { return &names }
 
 func (r *_386Regs) Get(i int) Word {
        switch i {
index 068add85d8731b496775025c52985260fd1e34c7..64559dc9e14c9a5ce0b433b4b2051e7f7a4317fc 100644 (file)
@@ -48,9 +48,7 @@ var names = [...]string{
        //"gs_base",
 }
 
-func (r *amd64Regs) PC() Word {
-       return Word(r.Rip);
-}
+func (r *amd64Regs) PC() Word  { return Word(r.Rip) }
 
 func (r *amd64Regs) SetPC(val Word) os.Error {
        r.Rip = uint64(val);
@@ -66,18 +64,14 @@ func (r *amd64Regs) SetLink(val Word) os.Error {
        panic("No link register");
 }
 
-func (r *amd64Regs) SP() Word {
-       return Word(r.Rsp);
-}
+func (r *amd64Regs) SP() Word  { return Word(r.Rsp) }
 
 func (r *amd64Regs) SetSP(val Word) os.Error {
        r.Rsp = uint64(val);
        return r.setter(&r.PtraceRegs);
 }
 
-func (r *amd64Regs) Names() []string {
-       return &names;
-}
+func (r *amd64Regs) Names() []string   { return &names }
 
 func (r *amd64Regs) Get(i int) Word {
        switch i {
index ac4bfb4f0ba44365fa4de7c1db5cabeedb6ed6d4..ed2834f697642aa33d6e843aeff50569ebb33eb3 100644 (file)
@@ -13,37 +13,21 @@ import (
 
 type armRegs struct{}
 
-func (r *armRegs) PC() Word {
-       return Word(0);
-}
+func (r *armRegs) PC() Word    { return Word(0) }
 
-func (r *armRegs) SetPC(val Word) os.Error {
-       return nil;
-}
+func (r *armRegs) SetPC(val Word) os.Error     { return nil }
 
-func (r *armRegs) Link() Word {
-       return Word(0);
-}
+func (r *armRegs) Link() Word  { return Word(0) }
 
-func (r *armRegs) SetLink(val Word) os.Error {
-       return nil;
-}
+func (r *armRegs) SetLink(val Word) os.Error   { return nil }
 
-func (r *armRegs) SP() Word {
-       return Word(0);
-}
+func (r *armRegs) SP() Word    { return Word(0) }
 
-func (r *armRegs) SetSP(val Word) os.Error {
-       return nil;
-}
+func (r *armRegs) SetSP(val Word) os.Error     { return nil }
 
-func (r *armRegs) Names() []string {
-       return nil;
-}
+func (r *armRegs) Names() []string     { return nil }
 
-func (r *armRegs) Get(i int) Word {
-       return Word(0);
-}
+func (r *armRegs) Get(i int) Word      { return Word(0) }
 
 func (r *armRegs) Set(i int, val Word) os.Error {
        return nil;
index 1561b7b022894c27e9614ab5ce5b61fb0358eceb..fdbb4b1ea9b653c6c5388ac205d9821b3ef88e0d 100644 (file)
@@ -106,14 +106,10 @@ func (x Sequence) Pos() token.Position {
 }
 
 
-func (x Range) Pos() token.Position {
-       return x.Begin.Pos();
-}
+func (x Range) Pos() token.Position    { return x.Begin.Pos() }
 
 
-func (p *Production) Pos() token.Position {
-       return p.Name.Pos();
-}
+func (p *Production) Pos() token.Position      { return p.Name.Pos() }
 
 
 // ----------------------------------------------------------------------------
index adf1fe7dd1ad719b545d940d93112c189c3af08f..a1d9f7a7ae216588ad63751aa21bee06e31d8ffe 100644 (file)
@@ -84,18 +84,14 @@ func Encode(dst, src []byte) int {
 }
 
 // MaxEncodedLen returns the maximum length of an encoding of n source bytes.
-func MaxEncodedLen(n int) int {
-       return (n+3)/4*5;
-}
+func MaxEncodedLen(n int) int  { return (n+3)/4*5 }
 
 // NewEncoder returns a new ascii85 stream encoder.  Data written to
 // the returned writer will be encoded and then written to w.
 // Ascii85 encodings operate in 32-bit blocks; when finished
 // writing, the caller must Close the returned encoder to flush any
 // trailing partial block.
-func NewEncoder(w io.Writer) io.WriteCloser {
-       return &encoder{w: w};
-}
+func NewEncoder(w io.Writer) io.WriteCloser    { return &encoder{w: w} }
 
 type encoder struct {
        err     os.Error;
@@ -248,9 +244,7 @@ func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err os.Error) {
 }
 
 // NewDecoder constructs a new ascii85 stream decoder.
-func NewDecoder(r io.Reader) io.Reader {
-       return &decoder{r: r};
-}
+func NewDecoder(r io.Reader) io.Reader { return &decoder{r: r} }
 
 type decoder struct {
        err     os.Error;
index 9079f74fe13e6fec717e2cf059be00f3230300f0..33010aa1b149d650d6c3a7515d622f98b36ed320 100644 (file)
@@ -189,9 +189,7 @@ func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser {
 
 // EncodedLen returns the length in bytes of the base64 encoding
 // of an input buffer of length n.
-func (enc *Encoding) EncodedLen(n int) int {
-       return (n+2)/3*4;
-}
+func (enc *Encoding) EncodedLen(n int) int     { return (n+2)/3*4 }
 
 /*
  * Decoder
@@ -329,6 +327,4 @@ func NewDecoder(enc *Encoding, r io.Reader) io.Reader {
 
 // DecodeLen returns the maximum length in bytes of the decoded data
 // corresponding to n bytes of base64-encoded data.
-func (enc *Encoding) DecodedLen(n int) int {
-       return n/4*3;
-}
+func (enc *Encoding) DecodedLen(n int) int     { return n/4*3 }
index c49879c664b85e398ce0ded9783565a6a084fa66..6907fa02cdafc9af3f716db7eea36cc93ff83c7c 100644 (file)
@@ -34,9 +34,7 @@ var BigEndian ByteOrder = bigEndian(0)
 
 type littleEndian unused
 
-func (littleEndian) Uint16(b []byte) uint16 {
-       return uint16(b[0]) | uint16(b[1])<<8;
-}
+func (littleEndian) Uint16(b []byte) uint16    { return uint16(b[0]) | uint16(b[1])<<8 }
 
 func (littleEndian) PutUint16(b []byte, v uint16) {
        b[0] = byte(v);
@@ -70,19 +68,13 @@ func (littleEndian) PutUint64(b []byte, v uint64) {
        b[7] = byte(v>>56);
 }
 
-func (littleEndian) String() string {
-       return "LittleEndian";
-}
+func (littleEndian) String() string    { return "LittleEndian" }
 
-func (littleEndian) GoString() string {
-       return "binary.LittleEndian";
-}
+func (littleEndian) GoString() string  { return "binary.LittleEndian" }
 
 type bigEndian unused
 
-func (bigEndian) Uint16(b []byte) uint16 {
-       return uint16(b[1]) | uint16(b[0])<<8;
-}
+func (bigEndian) Uint16(b []byte) uint16       { return uint16(b[1]) | uint16(b[0])<<8 }
 
 func (bigEndian) PutUint16(b []byte, v uint16) {
        b[0] = byte(v>>8);
@@ -116,13 +108,9 @@ func (bigEndian) PutUint64(b []byte, v uint64) {
        b[7] = byte(v);
 }
 
-func (bigEndian) String() string {
-       return "BigEndian";
-}
+func (bigEndian) String() string       { return "BigEndian" }
 
-func (bigEndian) GoString() string {
-       return "binary.BigEndian";
-}
+func (bigEndian) GoString() string     { return "binary.BigEndian" }
 
 // Read reads structured binary data from r into data.
 // Data must be a pointer to a fixed-size value.
@@ -218,21 +206,13 @@ func (d *decoder) uint64() uint64 {
        return x;
 }
 
-func (d *decoder) int8() int8 {
-       return int8(d.uint8());
-}
+func (d *decoder) int8() int8  { return int8(d.uint8()) }
 
-func (d *decoder) int16() int16 {
-       return int16(d.uint16());
-}
+func (d *decoder) int16() int16        { return int16(d.uint16()) }
 
-func (d *decoder) int32() int32 {
-       return int32(d.uint32());
-}
+func (d *decoder) int32() int32        { return int32(d.uint32()) }
 
-func (d *decoder) int64() int64 {
-       return int64(d.uint64());
-}
+func (d *decoder) int64() int64        { return int64(d.uint64()) }
 
 func (d *decoder) value(v reflect.Value) {
        switch v := v.(type) {
index 51e4654dd356cd831a0ca4bf6de943f2fce35bf7..e49251fb3a70bc78e53ce7b9224755965df54559 100644 (file)
@@ -142,18 +142,14 @@ func Decode(dst, src []byte) (n int, err os.Error) {
        return ndst, nil;
 }
 
-func MaxDecodedLen(n int) int {
-       return n/5*4;
-}
+func MaxDecodedLen(n int) int  { return n/5*4 }
 
 // NewEncoder returns a new GIT base85 stream encoder.  Data written to
 // the returned writer will be encoded and then written to w.
 // The GIT encoding operates on 52-byte blocks; when finished
 // writing, the caller must Close the returned encoder to flush any
 // partially written blocks.
-func NewEncoder(w io.Writer) io.WriteCloser {
-       return &encoder{w: w};
-}
+func NewEncoder(w io.Writer) io.WriteCloser    { return &encoder{w: w} }
 
 type encoder struct {
        w       io.Writer;
@@ -224,9 +220,7 @@ func (e *encoder) Close() os.Error {
 }
 
 // NewDecoder returns a new GIT base85 stream decoder.
-func NewDecoder(r io.Reader) io.Reader {
-       return &decoder{r: r};
-}
+func NewDecoder(r io.Reader) io.Reader { return &decoder{r: r} }
 
 type decoder struct {
        r       io.Reader;
index 77aa1330551cf41b88ffa96f9b68f0c0ac253350..ff55dd489a5f45d4ae229fc9ece8a80e1838ad1e 100644 (file)
@@ -14,9 +14,7 @@ import (
 const hextable = "0123456789abcdef"
 
 // EncodedLen returns the length of an encoding of n source bytes.
-func EncodedLen(n int) int {
-       return n*2;
-}
+func EncodedLen(n int) int     { return n*2 }
 
 // Encode encodes src into EncodedLen(len(src))
 // bytes of dst.  As a convenience, it returns the number
@@ -34,9 +32,7 @@ func Encode(dst, src []byte) int {
 // OddLengthInputError results from decoding an odd length slice.
 type OddLengthInputError struct{}
 
-func (OddLengthInputError) String() string {
-       return "odd length hex string";
-}
+func (OddLengthInputError) String() string     { return "odd length hex string" }
 
 // InvalidHexCharError results from finding an invalid character in a hex string.
 type InvalidHexCharError byte
@@ -46,9 +42,7 @@ func (e InvalidHexCharError) String() string {
 }
 
 
-func DecodedLen(x int) int {
-       return x/2;
-}
+func DecodedLen(x int) int     { return x/2 }
 
 // Decode decodes src into DecodedLen(len(src)) bytes, returning the actual
 // number of bytes written to dst.
index f5eb14b6ace153c2df48c5d83ee4ae0f24ca283b..fbe8c5f0a4ae648423361184f2642addcefb9f02 100644 (file)
@@ -70,9 +70,7 @@ func audioServer() {
        }
 }
 
-func PlaySound(b []uint16) {
-       sndc <- b;
-}
+func PlaySound(b []uint16)     { sndc <- b }
 
 var whoosh = []uint16{
 // Insert your favorite sound samples here.
index bea3a49e6a36ea848ba9d82a7a2709594368115a..28c9e74496bf3efa379df6704f51e421949ed989 100644 (file)
@@ -332,17 +332,13 @@ func newState(fmt Format, env Environment, errors chan os.Error) *State {
 
 
 // Env returns the environment passed to Format.Apply.
-func (s *State) Env() interface{} {
-       return s.env;
-}
+func (s *State) Env() interface{}      { return s.env }
 
 
 // LinePos returns the position of the current line beginning
 // in the state's output buffer. Line numbers start at 1.
 //
-func (s *State) LinePos() token.Position {
-       return s.linePos;
-}
+func (s *State) LinePos() token.Position       { return s.linePos }
 
 
 // Pos returns the position of the next byte to be written to the
index af4adfa9f348ec624c2047d3f18676803d336dd7..c43cca2b7f997d5043446ab97235bfcb7db01643 100644 (file)
@@ -236,9 +236,7 @@ const F1 = `datafmt "datafmt";`
        `int = "%d";`
        `datafmt.T1 = "<" a ">";`
 
-func TestStruct1(t *testing.T) {
-       check(t, F1, "<42>", T1{42});
-}
+func TestStruct1(t *testing.T) { check(t, F1, "<42>", T1{42}) }
 
 
 // ----------------------------------------------------------------------------
@@ -354,9 +352,7 @@ func TestStructPoint(t *testing.T) {
 const FSlice = `int = "%b";`
        `array = { * / ", " }`
 
-func TestSlice(t *testing.T) {
-       check(t, FSlice, "10, 11, 101, 111", []int{2, 3, 5, 7});
-}
+func TestSlice(t *testing.T)   { check(t, FSlice, "10, 11, 101, 111", []int{2, 3, 5, 7}) }
 
 
 // TODO add more tests
index 43aefbaade167db36d5784cd451399e32bf0467e..314754ea90b268d45aa525493a23c373112d1d2c 100644 (file)
@@ -21,44 +21,28 @@ type Rectangle struct {
 var ZR Rectangle
 
 // Pt is shorthand for Point{X, Y}.
-func Pt(X, Y int) Point {
-       return Point{X, Y};
-}
+func Pt(X, Y int) Point        { return Point{X, Y} }
 
 // Rect is shorthand for Rectangle{Pt(x0, y0), Pt(x1, y1)}.
-func Rect(x0, y0, x1, y1 int) Rectangle {
-       return Rectangle{Point{x0, y0}, Point{x1, y1}};
-}
+func Rect(x0, y0, x1, y1 int) Rectangle        { return Rectangle{Point{x0, y0}, Point{x1, y1}} }
 
 // Rpt is shorthand for Rectangle{min, max}.
-func Rpt(min, max Point) Rectangle {
-       return Rectangle{min, max};
-}
+func Rpt(min, max Point) Rectangle     { return Rectangle{min, max} }
 
 // Add returns the sum of p and q: Pt(p.X+q.X, p.Y+q.Y).
-func (p Point) Add(q Point) Point {
-       return Point{p.X + q.X, p.Y + q.Y};
-}
+func (p Point) Add(q Point) Point      { return Point{p.X + q.X, p.Y + q.Y} }
 
 // Sub returns the difference of p and q: Pt(p.X-q.X, p.Y-q.Y).
-func (p Point) Sub(q Point) Point {
-       return Point{p.X - q.X, p.Y - q.Y};
-}
+func (p Point) Sub(q Point) Point      { return Point{p.X - q.X, p.Y - q.Y} }
 
 // Mul returns p scaled by k: Pt(p.X*k p.Y*k).
-func (p Point) Mul(k int) Point {
-       return Point{p.X * k, p.Y * k};
-}
+func (p Point) Mul(k int) Point        { return Point{p.X * k, p.Y * k} }
 
 // Div returns p divided by k: Pt(p.X/k, p.Y/k).
-func (p Point) Div(k int) Point {
-       return Point{p.X / k, p.Y / k};
-}
+func (p Point) Div(k int) Point        { return Point{p.X / k, p.Y / k} }
 
 // Eq returns true if p and q are equal.
-func (p Point) Eq(q Point) bool {
-       return p.X == q.X && p.Y == q.Y;
-}
+func (p Point) Eq(q Point) bool        { return p.X == q.X && p.Y == q.Y }
 
 // Inset returns the rectangle r inset by n: Rect(r.Min.X+n, r.Min.Y+n, r.Max.X-n, r.Max.Y-n).
 func (r Rectangle) Inset(n int) Rectangle {
@@ -66,14 +50,10 @@ func (r Rectangle) Inset(n int) Rectangle {
 }
 
 // Add returns the rectangle r translated by p: Rpt(r.Min.Add(p), r.Max.Add(p)).
-func (r Rectangle) Add(p Point) Rectangle {
-       return Rectangle{r.Min.Add(p), r.Max.Add(p)};
-}
+func (r Rectangle) Add(p Point) Rectangle      { return Rectangle{r.Min.Add(p), r.Max.Add(p)} }
 
 // Sub returns the rectangle r translated by -p: Rpt(r.Min.Sub(p), r.Max.Sub(p)).
-func (r Rectangle) Sub(p Point) Rectangle {
-       return Rectangle{r.Min.Sub(p), r.Max.Sub(p)};
-}
+func (r Rectangle) Sub(p Point) Rectangle      { return Rectangle{r.Min.Sub(p), r.Max.Sub(p)} }
 
 // Canon returns a canonical version of r: the returned rectangle
 // has Min.X <= Max.X and Min.Y <= Max.Y.
@@ -94,9 +74,7 @@ func (r Rectangle) Overlaps(r1 Rectangle) bool {
 }
 
 // Empty retruns true if r contains no points.
-func (r Rectangle) Empty() bool {
-       return r.Max.X <= r.Min.X || r.Max.Y <= r.Min.Y;
-}
+func (r Rectangle) Empty() bool        { return r.Max.X <= r.Min.X || r.Max.Y <= r.Min.Y }
 
 // InRect returns true if all the points in r are also in r1.
 func (r Rectangle) In(r1 Rectangle) bool {
@@ -157,11 +135,7 @@ func (r Rectangle) Clip(r1 Rectangle) Rectangle {
 }
 
 // Dx returns the width of the rectangle r: r.Max.X - r.Min.X.
-func (r Rectangle) Dx() int {
-       return r.Max.X - r.Min.X;
-}
+func (r Rectangle) Dx() int    { return r.Max.X - r.Min.X }
 
 // Dy returns the width of the rectangle r: r.Max.Y - r.Min.Y.
-func (r Rectangle) Dy() int {
-       return r.Max.Y - r.Min.Y;
-}
+func (r Rectangle) Dy() int    { return r.Max.Y - r.Min.Y }
index db772c7ad7203fb7152d769ef98eefec093a7d52..310f70e30d892d39733baa104ddf3c151ec1fac1 100644 (file)
@@ -92,17 +92,11 @@ func (c Color) SetAlpha(a uint8) Color {
        return r<<24 | g<<16 | b<<8 | Color(a);
 }
 
-func (c Color) Width() int {
-       return 1e9;
-}
+func (c Color) Width() int     { return 1e9 }
 
-func (c Color) Height() int {
-       return 1e9;
-}
+func (c Color) Height() int    { return 1e9 }
 
-func (c Color) At(x, y int) image.Color {
-       return c;
-}
+func (c Color) At(x, y int) image.Color        { return c }
 
 func toColor(color image.Color) image.Color {
        if c, ok := color.(Color); ok {
@@ -112,6 +106,4 @@ func toColor(color image.Color) image.Color {
        return Color(r>>24<<24 | g>>24<<16 | b>>24<<8 | a>>24);
 }
 
-func (c Color) ColorModel() image.ColorModel {
-       return image.ColorModelFunc(toColor);
-}
+func (c Color) ColorModel() image.ColorModel   { return image.ColorModelFunc(toColor) }
index 346722c8c15e3fb71c0cbc0b75bb3c923466b11d..6cac2175ac195ccb649399f89a2bda4e8b1029d5 100644 (file)
@@ -37,15 +37,11 @@ func (t *Thread) Try(f func(t *Thread)) os.Error {
 
 type DivByZeroError struct{}
 
-func (DivByZeroError) String() string {
-       return "divide by zero";
-}
+func (DivByZeroError) String() string  { return "divide by zero" }
 
 type NilPointerError struct{}
 
-func (NilPointerError) String() string {
-       return "nil pointer dereference";
-}
+func (NilPointerError) String() string { return "nil pointer dereference" }
 
 type IndexError struct {
        Idx, Len int64;
@@ -70,9 +66,7 @@ type KeyError struct {
        Key interface{};
 }
 
-func (e KeyError) String() string {
-       return fmt.Sprintf("key '%v' not found in map", e.Key);
-}
+func (e KeyError) String() string      { return fmt.Sprintf("key '%v' not found in map", e.Key) }
 
 type NegativeLengthError struct {
        Len int64;
index d4bf2b888f97147b4a3565737eb9c7cd25e2b4aa..d10aade9edf40b3d5fef8b5c1a7159878fabffc4 100644 (file)
@@ -130,9 +130,7 @@ func TypeFromNative(t reflect.Type) Type {
 }
 
 // TypeOfNative returns the interpreter Type of a regular Go value.
-func TypeOfNative(v interface{}) Type {
-       return TypeFromNative(reflect.Typeof(v));
-}
+func TypeOfNative(v interface{}) Type  { return TypeFromNative(reflect.Typeof(v)) }
 
 /*
  * Function bridging
index 9d57d7abea9a38896d210dcc872cb868be96823b..f349b836f26d1e59f13db4e766c081fb39a05143 100644 (file)
@@ -32,9 +32,7 @@ func (a *compiler) diagAt(pos positioned, format string, args ...) {
        a.numErrors++;
 }
 
-func (a *compiler) numError() int {
-       return a.numErrors + a.silentErrors;
-}
+func (a *compiler) numError() int      { return a.numErrors + a.silentErrors }
 
 // The universal scope
 func newUniverse() *Scope {
index 4d711bfc44ff0cf476032c1b6305f2e22e2527cf..307c5048683abd0c53498b95d33858dd9a38f67b 100644 (file)
@@ -17,9 +17,7 @@ import (
 // Print each statement or expression before parsing it
 var noisy = false
 
-func init() {
-       flag.BoolVar(&noisy, "noisy", false, "chatter during eval tests");
-}
+func init()    { flag.BoolVar(&noisy, "noisy", false, "chatter during eval tests") }
 
 /*
  * Generic statement/expression test framework
@@ -104,14 +102,10 @@ func match(t *testing.T, err os.Error, pat string) bool {
  */
 
 // Expression compile error
-func CErr(expr string, cerr string) test {
-       return test([]job{job{code: expr, cerr: cerr}});
-}
+func CErr(expr string, cerr string) test       { return test([]job{job{code: expr, cerr: cerr}}) }
 
 // Expression runtime error
-func RErr(expr string, rterr string) test {
-       return test([]job{job{code: expr, rterr: rterr}});
-}
+func RErr(expr string, rterr string) test      { return test([]job{job{code: expr, rterr: rterr}}) }
 
 // Expression value
 func Val(expr string, val interface{}) test {
@@ -119,9 +113,7 @@ func Val(expr string, val interface{}) test {
 }
 
 // Statement runs without error
-func Run(stmts string) test {
-       return test([]job{job{code: stmts, noval: true}});
-}
+func Run(stmts string) test    { return test([]job{job{code: stmts, noval: true}}) }
 
 // Two statements without error.
 // TODO(rsc): Should be possible with Run but the parser
@@ -213,9 +205,7 @@ func toValue(val interface{}) Value {
 
 type testFunc struct{}
 
-func (*testFunc) NewFrame() *Frame {
-       return &Frame{nil, &[2]Value{}};
-}
+func (*testFunc) NewFrame() *Frame     { return &Frame{nil, &[2]Value{}} }
 
 func (*testFunc) Call(t *Thread) {
        n := t.f.Vars[0].(IntValue).Get(t);
@@ -227,9 +217,7 @@ func (*testFunc) Call(t *Thread) {
 
 type oneTwoFunc struct{}
 
-func (*oneTwoFunc) NewFrame() *Frame {
-       return &Frame{nil, &[2]Value{}};
-}
+func (*oneTwoFunc) NewFrame() *Frame   { return &Frame{nil, &[2]Value{}} }
 
 func (*oneTwoFunc) Call(t *Thread) {
        t.f.Vars[0].(IntValue).Set(t, 1);
@@ -238,12 +226,9 @@ func (*oneTwoFunc) Call(t *Thread) {
 
 type voidFunc struct{}
 
-func (*voidFunc) NewFrame() *Frame {
-       return &Frame{nil, []Value{}};
-}
+func (*voidFunc) NewFrame() *Frame     { return &Frame{nil, []Value{}} }
 
-func (*voidFunc) Call(t *Thread) {
-}
+func (*voidFunc) Call(t *Thread)       {}
 
 func newTestWorld() *World {
        w := NewWorld();
index c2b0dbf7bae6993f2a78c5b30af246d4f5ec1652..af6259a78d2bd79e414e80e8b14605a4167c14bd 100644 (file)
@@ -402,9 +402,7 @@ func (a *assignCompiler) compile(b *block, lt Type) (func(Value, *Thread)) {
                                                rf := a.rs[i].asPtr();
                                                a.rs[i] = a.rs[i].newExpr(lt, a.rs[i].desc);
                                                len := at.Len;
-                                               a.rs[i].eval = func(t *Thread) Slice {
-                                                       return Slice{rf(t).(ArrayValue), len, len};
-                                               };
+                                               a.rs[i].eval = func(t *Thread) Slice { return Slice{rf(t).(ArrayValue), len, len} };
                                                rt = a.rs[i].t;
                                        }
                                }
@@ -1592,17 +1590,13 @@ func (a *exprInfo) compileBinaryExpr(op token.Token, l, r *expr) *expr {
        // Useful type predicates
        // TODO(austin) CL 33668 mandates identical types except for comparisons.
        compat := func() bool { return l.t.compat(r.t, false) };
-       integers := func() bool {
-               return l.t.isInteger() && r.t.isInteger();
-       };
+       integers := func() bool { return l.t.isInteger() && r.t.isInteger() };
        floats := func() bool { return l.t.isFloat() && r.t.isFloat() };
        strings := func() bool {
                // TODO(austin) Deal with named types
                return l.t == StringType && r.t == StringType;
        };
-       booleans := func() bool {
-               return l.t.isBoolean() && r.t.isBoolean();
-       };
+       booleans := func() bool { return l.t.isBoolean() && r.t.isBoolean() };
 
        // Type check
        var t Type;
index 547ca380aca07cf14773fba019ec71beecfe1487..c77c99934fafcb65f4cbb621b6be9d45200dd578 100644 (file)
@@ -12,15 +12,11 @@ import (
  * "As" functions.  These retrieve evaluator functions from an
  * expr, panicking if the requested evaluator has the wrong type.
  */
-func (a *expr) asBool() (func(*Thread) bool) {
-       return a.eval.(func(*Thread) bool);
-}
+func (a *expr) asBool() (func(*Thread) bool)   { return a.eval.(func(*Thread) bool) }
 func (a *expr) asUint() (func(*Thread) uint64) {
        return a.eval.(func(*Thread) uint64);
 }
-func (a *expr) asInt() (func(*Thread) int64) {
-       return a.eval.(func(*Thread) int64);
-}
+func (a *expr) asInt() (func(*Thread) int64)   { return a.eval.(func(*Thread) int64) }
 func (a *expr) asIdealInt() (func() *bignum.Integer) {
        return a.eval.(func() *bignum.Integer);
 }
@@ -39,18 +35,12 @@ func (a *expr) asArray() (func(*Thread) ArrayValue) {
 func (a *expr) asStruct() (func(*Thread) StructValue) {
        return a.eval.(func(*Thread) StructValue);
 }
-func (a *expr) asPtr() (func(*Thread) Value) {
-       return a.eval.(func(*Thread) Value);
-}
-func (a *expr) asFunc() (func(*Thread) Func) {
-       return a.eval.(func(*Thread) Func);
-}
+func (a *expr) asPtr() (func(*Thread) Value)   { return a.eval.(func(*Thread) Value) }
+func (a *expr) asFunc() (func(*Thread) Func)   { return a.eval.(func(*Thread) Func) }
 func (a *expr) asSlice() (func(*Thread) Slice) {
        return a.eval.(func(*Thread) Slice);
 }
-func (a *expr) asMap() (func(*Thread) Map) {
-       return a.eval.(func(*Thread) Map);
-}
+func (a *expr) asMap() (func(*Thread) Map)     { return a.eval.(func(*Thread) Map) }
 func (a *expr) asMulti() (func(*Thread) []Value) {
        return a.eval.(func(*Thread) []Value);
 }
@@ -132,49 +122,27 @@ func (a *expr) genIdentOp(level, index int) {
        a.evalAddr = func(t *Thread) Value { return t.f.Get(level, index) };
        switch a.t.lit().(type) {
        case *boolType:
-               a.eval = func(t *Thread) bool {
-                       return t.f.Get(level, index).(BoolValue).Get(t);
-               };
+               a.eval = func(t *Thread) bool { return t.f.Get(level, index).(BoolValue).Get(t) };
        case *uintType:
-               a.eval = func(t *Thread) uint64 {
-                       return t.f.Get(level, index).(UintValue).Get(t);
-               };
+               a.eval = func(t *Thread) uint64 { return t.f.Get(level, index).(UintValue).Get(t) };
        case *intType:
-               a.eval = func(t *Thread) int64 {
-                       return t.f.Get(level, index).(IntValue).Get(t);
-               };
+               a.eval = func(t *Thread) int64 { return t.f.Get(level, index).(IntValue).Get(t) };
        case *floatType:
-               a.eval = func(t *Thread) float64 {
-                       return t.f.Get(level, index).(FloatValue).Get(t);
-               };
+               a.eval = func(t *Thread) float64 { return t.f.Get(level, index).(FloatValue).Get(t) };
        case *stringType:
-               a.eval = func(t *Thread) string {
-                       return t.f.Get(level, index).(StringValue).Get(t);
-               };
+               a.eval = func(t *Thread) string { return t.f.Get(level, index).(StringValue).Get(t) };
        case *ArrayType:
-               a.eval = func(t *Thread) ArrayValue {
-                       return t.f.Get(level, index).(ArrayValue).Get(t);
-               };
+               a.eval = func(t *Thread) ArrayValue { return t.f.Get(level, index).(ArrayValue).Get(t) };
        case *StructType:
-               a.eval = func(t *Thread) StructValue {
-                       return t.f.Get(level, index).(StructValue).Get(t);
-               };
+               a.eval = func(t *Thread) StructValue { return t.f.Get(level, index).(StructValue).Get(t) };
        case *PtrType:
-               a.eval = func(t *Thread) Value {
-                       return t.f.Get(level, index).(PtrValue).Get(t);
-               };
+               a.eval = func(t *Thread) Value { return t.f.Get(level, index).(PtrValue).Get(t) };
        case *FuncType:
-               a.eval = func(t *Thread) Func {
-                       return t.f.Get(level, index).(FuncValue).Get(t);
-               };
+               a.eval = func(t *Thread) Func { return t.f.Get(level, index).(FuncValue).Get(t) };
        case *SliceType:
-               a.eval = func(t *Thread) Slice {
-                       return t.f.Get(level, index).(SliceValue).Get(t);
-               };
+               a.eval = func(t *Thread) Slice { return t.f.Get(level, index).(SliceValue).Get(t) };
        case *MapType:
-               a.eval = func(t *Thread) Map {
-                       return t.f.Get(level, index).(MapValue).Get(t);
-               };
+               a.eval = func(t *Thread) Map { return t.f.Get(level, index).(MapValue).Get(t) };
        default:
                log.Crashf("unexpected identifier type %v at %v", a.t, a.pos);
        }
index 11d993af0b22078dd6d8db3b35ad993f23ce2738..31ed530be692875570822fae61bb309acb41d387 100644 (file)
@@ -340,6 +340,4 @@ var exprTests = []test{
        CErr("fn==oneTwo", opTypes),
 }
 
-func TestExpr(t *testing.T) {
-       runTests(t, "exprTests", exprTests);
-}
+func TestExpr(t *testing.T)    { runTests(t, "exprTests", exprTests) }
index fac7b8629bfce0c4f9b552d74ff12ab1cf0fcbdd..103d2766d774e5f846db2fcbd48e897edfb7e5ab 100644 (file)
@@ -40,9 +40,7 @@ type codeBuf struct {
        instrs code;
 }
 
-func newCodeBuf() *codeBuf {
-       return &codeBuf{make(code, 0, 16)};
-}
+func newCodeBuf() *codeBuf     { return &codeBuf{make(code, 0, 16)} }
 
 func (b *codeBuf) push(instr func(*Thread)) {
        n := len(b.instrs);
@@ -57,9 +55,7 @@ func (b *codeBuf) push(instr func(*Thread)) {
        b.instrs[n] = instr;
 }
 
-func (b *codeBuf) nextPC() uint {
-       return uint(len(b.instrs));
-}
+func (b *codeBuf) nextPC() uint        { return uint(len(b.instrs)) }
 
 func (b *codeBuf) get() code {
        // Freeze this buffer into an array of exactly the right size
@@ -80,10 +76,6 @@ type evalFunc struct {
        code            code;
 }
 
-func (f *evalFunc) NewFrame() *Frame {
-       return f.outer.child(f.frameSize);
-}
+func (f *evalFunc) NewFrame() *Frame   { return f.outer.child(f.frameSize) }
 
-func (f *evalFunc) Call(t *Thread) {
-       f.code.exec(t);
-}
+func (f *evalFunc) Call(t *Thread)     { f.code.exec(t) }
index 1c3d1f62216f77acfcedbd67ef76c1c04c38d327..43df7cf631ed2591731590d89e3b0e68208d439c 100644 (file)
@@ -121,9 +121,7 @@ func (b *block) DefineVar(name string, pos token.Position, t Type) (*Variable, D
        return v, nil;
 }
 
-func (b *block) DefineTemp(t Type) *Variable {
-       return b.defineSlot(t, true);
-}
+func (b *block) DefineTemp(t Type) *Variable   { return b.defineSlot(t, true) }
 
 func (b *block) defineSlot(t Type, temp bool) *Variable {
        if b.inner != nil && b.inner.scope == b.scope {
@@ -175,9 +173,7 @@ func (b *block) Lookup(name string) (bl *block, level int, def Def) {
        return nil, 0, nil;
 }
 
-func (s *Scope) NewFrame(outer *Frame) *Frame {
-       return outer.child(s.maxVars);
-}
+func (s *Scope) NewFrame(outer *Frame) *Frame  { return outer.child(s.maxVars) }
 
 /*
  * Frames
index 433073a015d74932e6643a212557a0852b9e4738..b9dcfe5508afe2e5759bf9c8a5a4c2bccfe83c75 100644 (file)
@@ -89,9 +89,7 @@ func (f *flowBuf) put(cond bool, term bool, jumps []*uint) {
 
 // putTerm creates a flow control point at the next PC that
 // unconditionally terminates execution.
-func (f *flowBuf) putTerm() {
-       f.put(false, true, nil);
-}
+func (f *flowBuf) putTerm()    { f.put(false, true, nil) }
 
 // put1 creates a flow control point at the next PC that jumps to one
 // PC and, if cond is true, can also continue to the PC following the
@@ -1222,9 +1220,7 @@ func (a *blockCompiler) enterChild() *blockCompiler {
        };
 }
 
-func (a *blockCompiler) exit() {
-       a.block.exit();
-}
+func (a *blockCompiler) exit() { a.block.exit() }
 
 /*
  * Function compiler
index 55cea6df304b743405f3d01e71177da244629536..0adea1e626b33d340bed8b4f81952c69026819e2 100644 (file)
@@ -344,6 +344,4 @@ var stmtTests = []test{
        Run2("func f1(){}", "f1()"),
 }
 
-func TestStmt(t *testing.T) {
-       runTests(t, "stmtTests", stmtTests);
-}
+func TestStmt(t *testing.T)    { runTests(t, "stmtTests", stmtTests) }
index 261dcc3cee24718b3c77c7e7e3b24f3b2d5e56b2..85f96fb19d88715cdeeb7a79222bce6ed5dd8088 100644 (file)
@@ -92,9 +92,7 @@ func hashTypeArray(key []Type) uintptr {
        return hash;
 }
 
-func newTypeArrayMap() typeArrayMap {
-       return make(map[uintptr]*typeArrayMapEntry);
-}
+func newTypeArrayMap() typeArrayMap    { return make(map[uintptr]*typeArrayMapEntry) }
 
 func (m typeArrayMap) Get(key []Type) interface{} {
        ent, ok := m[hashTypeArray(key)];
@@ -134,25 +132,15 @@ func (m typeArrayMap) Put(key []Type, v interface{}) interface{} {
 
 type commonType struct{}
 
-func (commonType) isBoolean() bool {
-       return false;
-}
+func (commonType) isBoolean() bool     { return false }
 
-func (commonType) isInteger() bool {
-       return false;
-}
+func (commonType) isInteger() bool     { return false }
 
-func (commonType) isFloat() bool {
-       return false;
-}
+func (commonType) isFloat() bool       { return false }
 
-func (commonType) isIdeal() bool {
-       return false;
-}
+func (commonType) isIdeal() bool       { return false }
 
-func (commonType) Pos() token.Position {
-       return token.Position{};
-}
+func (commonType) Pos() token.Position { return token.Position{} }
 
 /*
  * Bool
@@ -169,13 +157,9 @@ func (t *boolType) compat(o Type, conv bool) bool {
        return ok;
 }
 
-func (t *boolType) lit() Type {
-       return t;
-}
+func (t *boolType) lit() Type  { return t }
 
-func (t *boolType) isBoolean() bool {
-       return true;
-}
+func (t *boolType) isBoolean() bool    { return true }
 
 func (boolType) String() string {
        // Use angle brackets as a convention for printing the
@@ -219,17 +203,11 @@ func (t *uintType) compat(o Type, conv bool) bool {
        ;
 }
 
-func (t *uintType) lit() Type {
-       return t;
-}
+func (t *uintType) lit() Type  { return t }
 
-func (t *uintType) isInteger() bool {
-       return true;
-}
+func (t *uintType) isInteger() bool    { return true }
 
-func (t *uintType) String() string {
-       return "<" + t.name + ">";
-}
+func (t *uintType) String() string     { return "<" + t.name + ">" }
 
 func (t *uintType) Zero() Value {
        switch t.Bits {
@@ -257,9 +235,7 @@ func (t *uintType) Zero() Value {
        panic("unexpected uint bit count: ", t.Bits);
 }
 
-func (t *uintType) minVal() *bignum.Rational {
-       return bignum.Rat(0, 1);
-}
+func (t *uintType) minVal() *bignum.Rational   { return bignum.Rat(0, 1) }
 
 func (t *uintType) maxVal() *bignum.Rational {
        bits := t.Bits;
@@ -304,17 +280,11 @@ func (t *intType) compat(o Type, conv bool) bool {
        return ok && t == t2;
 }
 
-func (t *intType) lit() Type {
-       return t;
-}
+func (t *intType) lit() Type   { return t }
 
-func (t *intType) isInteger() bool {
-       return true;
-}
+func (t *intType) isInteger() bool     { return true }
 
-func (t *intType) String() string {
-       return "<" + t.name + ">";
-}
+func (t *intType) String() string      { return "<" + t.name + ">" }
 
 func (t *intType) Zero() Value {
        switch t.Bits {
@@ -369,25 +339,15 @@ func (t *idealIntType) compat(o Type, conv bool) bool {
        return ok;
 }
 
-func (t *idealIntType) lit() Type {
-       return t;
-}
+func (t *idealIntType) lit() Type      { return t }
 
-func (t *idealIntType) isInteger() bool {
-       return true;
-}
+func (t *idealIntType) isInteger() bool        { return true }
 
-func (t *idealIntType) isIdeal() bool {
-       return true;
-}
+func (t *idealIntType) isIdeal() bool  { return true }
 
-func (t *idealIntType) String() string {
-       return "ideal integer";
-}
+func (t *idealIntType) String() string { return "ideal integer" }
 
-func (t *idealIntType) Zero() Value {
-       return &idealIntV{bignum.Int(0)};
-}
+func (t *idealIntType) Zero() Value    { return &idealIntV{bignum.Int(0)} }
 
 /*
  * Float
@@ -413,17 +373,11 @@ func (t *floatType) compat(o Type, conv bool) bool {
        return ok && t == t2;
 }
 
-func (t *floatType) lit() Type {
-       return t;
-}
+func (t *floatType) lit() Type { return t }
 
-func (t *floatType) isFloat() bool {
-       return true;
-}
+func (t *floatType) isFloat() bool     { return true }
 
-func (t *floatType) String() string {
-       return "<" + t.name + ">";
-}
+func (t *floatType) String() string    { return "<" + t.name + ">" }
 
 func (t *floatType) Zero() Value {
        switch t.Bits {
@@ -490,25 +444,15 @@ func (t *idealFloatType) compat(o Type, conv bool) bool {
        return ok;
 }
 
-func (t *idealFloatType) lit() Type {
-       return t;
-}
+func (t *idealFloatType) lit() Type    { return t }
 
-func (t *idealFloatType) isFloat() bool {
-       return true;
-}
+func (t *idealFloatType) isFloat() bool        { return true }
 
-func (t *idealFloatType) isIdeal() bool {
-       return true;
-}
+func (t *idealFloatType) isIdeal() bool        { return true }
 
-func (t *idealFloatType) String() string {
-       return "ideal float";
-}
+func (t *idealFloatType) String() string       { return "ideal float" }
 
-func (t *idealFloatType) Zero() Value {
-       return &idealFloatV{bignum.Rat(1, 0)};
-}
+func (t *idealFloatType) Zero() Value  { return &idealFloatV{bignum.Rat(1, 0)} }
 
 /*
  * String
@@ -525,13 +469,9 @@ func (t *stringType) compat(o Type, conv bool) bool {
        return ok;
 }
 
-func (t *stringType) lit() Type {
-       return t;
-}
+func (t *stringType) lit() Type        { return t }
 
-func (t *stringType) String() string {
-       return "<string>";
-}
+func (t *stringType) String() string   { return "<string>" }
 
 func (t *stringType) Zero() Value {
        res := stringV("");
@@ -575,13 +515,9 @@ func (t *ArrayType) compat(o Type, conv bool) bool {
        return t.Len == t2.Len && t.Elem.compat(t2.Elem, conv);
 }
 
-func (t *ArrayType) lit() Type {
-       return t;
-}
+func (t *ArrayType) lit() Type { return t }
 
-func (t *ArrayType) String() string {
-       return "[]" + t.Elem.String();
-}
+func (t *ArrayType) String() string    { return "[]" + t.Elem.String() }
 
 func (t *ArrayType) Zero() Value {
        res := arrayV(make([]Value, t.Len));
@@ -682,9 +618,7 @@ func (t *StructType) compat(o Type, conv bool) bool {
        return true;
 }
 
-func (t *StructType) lit() Type {
-       return t;
-}
+func (t *StructType) lit() Type        { return t }
 
 func (t *StructType) String() string {
        s := "struct {";
@@ -738,17 +672,11 @@ func (t *PtrType) compat(o Type, conv bool) bool {
        return t.Elem.compat(t2.Elem, conv);
 }
 
-func (t *PtrType) lit() Type {
-       return t;
-}
+func (t *PtrType) lit() Type   { return t }
 
-func (t *PtrType) String() string {
-       return "*" + t.Elem.String();
-}
+func (t *PtrType) String() string      { return "*" + t.Elem.String() }
 
-func (t *PtrType) Zero() Value {
-       return &ptrV{nil};
-}
+func (t *PtrType) Zero() Value { return &ptrV{nil} }
 
 /*
  * Function
@@ -828,9 +756,7 @@ func (t *FuncType) compat(o Type, conv bool) bool {
        return true;
 }
 
-func (t *FuncType) lit() Type {
-       return t;
-}
+func (t *FuncType) lit() Type  { return t }
 
 func typeListString(ts []Type, ns []*ast.Ident) string {
        s := "";
@@ -869,9 +795,7 @@ func (t *FuncType) String() string {
        return s;
 }
 
-func (t *FuncType) Zero() Value {
-       return &funcV{nil};
-}
+func (t *FuncType) Zero() Value        { return &funcV{nil} }
 
 type FuncDecl struct {
        Type    *FuncType;
@@ -978,17 +902,11 @@ func NewInterfaceType(methods []IMethod, embeds []*InterfaceType) *InterfaceType
 
 type iMethodSorter []IMethod
 
-func (s iMethodSorter) Less(a, b int) bool {
-       return s[a].Name < s[b].Name;
-}
+func (s iMethodSorter) Less(a, b int) bool     { return s[a].Name < s[b].Name }
 
-func (s iMethodSorter) Swap(a, b int) {
-       s[a], s[b] = s[b], s[a];
-}
+func (s iMethodSorter) Swap(a, b int)  { s[a], s[b] = s[b], s[a] }
 
-func (s iMethodSorter) Len() int {
-       return len(s);
-}
+func (s iMethodSorter) Len() int       { return len(s) }
 
 func (t *InterfaceType) compat(o Type, conv bool) bool {
        t2, ok := o.lit().(*InterfaceType);
@@ -1007,9 +925,7 @@ func (t *InterfaceType) compat(o Type, conv bool) bool {
        return true;
 }
 
-func (t *InterfaceType) lit() Type {
-       return t;
-}
+func (t *InterfaceType) lit() Type     { return t }
 
 func (t *InterfaceType) String() string {
        // TODO(austin) Instead of showing embedded interfaces, this
@@ -1078,9 +994,7 @@ func (t *InterfaceType) implementedBy(o Type) (*IMethod, bool) {
        return &t.methods[0], false;
 }
 
-func (t *InterfaceType) Zero() Value {
-       return &interfaceV{};
-}
+func (t *InterfaceType) Zero() Value   { return &interfaceV{} }
 
 /*
  * Slice
@@ -1112,13 +1026,9 @@ func (t *SliceType) compat(o Type, conv bool) bool {
        return t.Elem.compat(t2.Elem, conv);
 }
 
-func (t *SliceType) lit() Type {
-       return t;
-}
+func (t *SliceType) lit() Type { return t }
 
-func (t *SliceType) String() string {
-       return "[]" + t.Elem.String();
-}
+func (t *SliceType) String() string    { return "[]" + t.Elem.String() }
 
 func (t *SliceType) Zero() Value {
        // The value of an uninitialized slice is nil. The length and
@@ -1160,13 +1070,9 @@ func (t *MapType) compat(o Type, conv bool) bool {
        return t.Elem.compat(t2.Elem, conv) && t.Key.compat(t2.Key, conv);
 }
 
-func (t *MapType) lit() Type {
-       return t;
-}
+func (t *MapType) lit() Type   { return t }
 
-func (t *MapType) String() string {
-       return "map[" + t.Key.String() + "] " + t.Elem.String();
-}
+func (t *MapType) String() string      { return "map[" + t.Key.String() + "] " + t.Elem.String() }
 
 func (t *MapType) Zero() Value {
        // The value of an uninitialized map is nil.
@@ -1239,33 +1145,19 @@ func (t *NamedType) compat(o Type, conv bool) bool {
        return o.compat(t.Def, conv);
 }
 
-func (t *NamedType) lit() Type {
-       return t.Def.lit();
-}
+func (t *NamedType) lit() Type { return t.Def.lit() }
 
-func (t *NamedType) isBoolean() bool {
-       return t.Def.isBoolean();
-}
+func (t *NamedType) isBoolean() bool   { return t.Def.isBoolean() }
 
-func (t *NamedType) isInteger() bool {
-       return t.Def.isInteger();
-}
+func (t *NamedType) isInteger() bool   { return t.Def.isInteger() }
 
-func (t *NamedType) isFloat() bool {
-       return t.Def.isFloat();
-}
+func (t *NamedType) isFloat() bool     { return t.Def.isFloat() }
 
-func (t *NamedType) isIdeal() bool {
-       return false;
-}
+func (t *NamedType) isIdeal() bool     { return false }
 
-func (t *NamedType) String() string {
-       return t.Name;
-}
+func (t *NamedType) String() string    { return t.Name }
 
-func (t *NamedType) Zero() Value {
-       return t.Def.Zero();
-}
+func (t *NamedType) Zero() Value       { return t.Def.Zero() }
 
 /*
  * Multi-valued type
@@ -1309,9 +1201,7 @@ func (t *MultiType) compat(o Type, conv bool) bool {
 
 var EmptyType Type = NewMultiType([]Type{})
 
-func (t *MultiType) lit() Type {
-       return t;
-}
+func (t *MultiType) lit() Type { return t }
 
 func (t *MultiType) String() string {
        if len(t.Elems) == 0 {
index 53722f90be4dff5079e904372594fdb1636bd231..d771adadaaac34e61bca2d988fd15f57f3fa70a5 100644 (file)
@@ -364,9 +364,7 @@ notimpl:
  * Type compiler interface
  */
 
-func noLateCheck() bool {
-       return true;
-}
+func noLateCheck() bool        { return true }
 
 func (a *compiler) compileType(b *block, typ ast.Expr) Type {
        tc := &typeCompiler{a, b, noLateCheck};
index f4f0bba0b3e040d7381b2cacd8bb6295a6830063..d57920538d4ddcf91a17347c2a05041977db26cb 100644 (file)
@@ -141,21 +141,13 @@ type MapValue interface {
 
 type boolV bool
 
-func (v *boolV) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *boolV) String() string        { return fmt.Sprint(*v) }
 
-func (v *boolV) Assign(t *Thread, o Value) {
-       *v = boolV(o.(BoolValue).Get(t));
-}
+func (v *boolV) Assign(t *Thread, o Value)     { *v = boolV(o.(BoolValue).Get(t)) }
 
-func (v *boolV) Get(*Thread) bool {
-       return bool(*v);
-}
+func (v *boolV) Get(*Thread) bool      { return bool(*v) }
 
-func (v *boolV) Set(t *Thread, x bool) {
-       *v = boolV(x);
-}
+func (v *boolV) Set(t *Thread, x bool) { *v = boolV(x) }
 
 /*
  * Uint
@@ -163,111 +155,63 @@ func (v *boolV) Set(t *Thread, x bool) {
 
 type uint8V uint8
 
-func (v *uint8V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *uint8V) String() string       { return fmt.Sprint(*v) }
 
-func (v *uint8V) Assign(t *Thread, o Value) {
-       *v = uint8V(o.(UintValue).Get(t));
-}
+func (v *uint8V) Assign(t *Thread, o Value)    { *v = uint8V(o.(UintValue).Get(t)) }
 
-func (v *uint8V) Get(*Thread) uint64 {
-       return uint64(*v);
-}
+func (v *uint8V) Get(*Thread) uint64   { return uint64(*v) }
 
-func (v *uint8V) Set(t *Thread, x uint64) {
-       *v = uint8V(x);
-}
+func (v *uint8V) Set(t *Thread, x uint64)      { *v = uint8V(x) }
 
 type uint16V uint16
 
-func (v *uint16V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *uint16V) String() string      { return fmt.Sprint(*v) }
 
-func (v *uint16V) Assign(t *Thread, o Value) {
-       *v = uint16V(o.(UintValue).Get(t));
-}
+func (v *uint16V) Assign(t *Thread, o Value)   { *v = uint16V(o.(UintValue).Get(t)) }
 
-func (v *uint16V) Get(*Thread) uint64 {
-       return uint64(*v);
-}
+func (v *uint16V) Get(*Thread) uint64  { return uint64(*v) }
 
-func (v *uint16V) Set(t *Thread, x uint64) {
-       *v = uint16V(x);
-}
+func (v *uint16V) Set(t *Thread, x uint64)     { *v = uint16V(x) }
 
 type uint32V uint32
 
-func (v *uint32V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *uint32V) String() string      { return fmt.Sprint(*v) }
 
-func (v *uint32V) Assign(t *Thread, o Value) {
-       *v = uint32V(o.(UintValue).Get(t));
-}
+func (v *uint32V) Assign(t *Thread, o Value)   { *v = uint32V(o.(UintValue).Get(t)) }
 
-func (v *uint32V) Get(*Thread) uint64 {
-       return uint64(*v);
-}
+func (v *uint32V) Get(*Thread) uint64  { return uint64(*v) }
 
-func (v *uint32V) Set(t *Thread, x uint64) {
-       *v = uint32V(x);
-}
+func (v *uint32V) Set(t *Thread, x uint64)     { *v = uint32V(x) }
 
 type uint64V uint64
 
-func (v *uint64V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *uint64V) String() string      { return fmt.Sprint(*v) }
 
-func (v *uint64V) Assign(t *Thread, o Value) {
-       *v = uint64V(o.(UintValue).Get(t));
-}
+func (v *uint64V) Assign(t *Thread, o Value)   { *v = uint64V(o.(UintValue).Get(t)) }
 
-func (v *uint64V) Get(*Thread) uint64 {
-       return uint64(*v);
-}
+func (v *uint64V) Get(*Thread) uint64  { return uint64(*v) }
 
-func (v *uint64V) Set(t *Thread, x uint64) {
-       *v = uint64V(x);
-}
+func (v *uint64V) Set(t *Thread, x uint64)     { *v = uint64V(x) }
 
 type uintV uint
 
-func (v *uintV) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *uintV) String() string        { return fmt.Sprint(*v) }
 
-func (v *uintV) Assign(t *Thread, o Value) {
-       *v = uintV(o.(UintValue).Get(t));
-}
+func (v *uintV) Assign(t *Thread, o Value)     { *v = uintV(o.(UintValue).Get(t)) }
 
-func (v *uintV) Get(*Thread) uint64 {
-       return uint64(*v);
-}
+func (v *uintV) Get(*Thread) uint64    { return uint64(*v) }
 
-func (v *uintV) Set(t *Thread, x uint64) {
-       *v = uintV(x);
-}
+func (v *uintV) Set(t *Thread, x uint64)       { *v = uintV(x) }
 
 type uintptrV uintptr
 
-func (v *uintptrV) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *uintptrV) String() string     { return fmt.Sprint(*v) }
 
-func (v *uintptrV) Assign(t *Thread, o Value) {
-       *v = uintptrV(o.(UintValue).Get(t));
-}
+func (v *uintptrV) Assign(t *Thread, o Value)  { *v = uintptrV(o.(UintValue).Get(t)) }
 
-func (v *uintptrV) Get(*Thread) uint64 {
-       return uint64(*v);
-}
+func (v *uintptrV) Get(*Thread) uint64 { return uint64(*v) }
 
-func (v *uintptrV) Set(t *Thread, x uint64) {
-       *v = uintptrV(x);
-}
+func (v *uintptrV) Set(t *Thread, x uint64)    { *v = uintptrV(x) }
 
 /*
  * Int
@@ -275,93 +219,53 @@ func (v *uintptrV) Set(t *Thread, x uint64) {
 
 type int8V int8
 
-func (v *int8V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *int8V) String() string        { return fmt.Sprint(*v) }
 
-func (v *int8V) Assign(t *Thread, o Value) {
-       *v = int8V(o.(IntValue).Get(t));
-}
+func (v *int8V) Assign(t *Thread, o Value)     { *v = int8V(o.(IntValue).Get(t)) }
 
-func (v *int8V) Get(*Thread) int64 {
-       return int64(*v);
-}
+func (v *int8V) Get(*Thread) int64     { return int64(*v) }
 
-func (v *int8V) Set(t *Thread, x int64) {
-       *v = int8V(x);
-}
+func (v *int8V) Set(t *Thread, x int64)        { *v = int8V(x) }
 
 type int16V int16
 
-func (v *int16V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *int16V) String() string       { return fmt.Sprint(*v) }
 
-func (v *int16V) Assign(t *Thread, o Value) {
-       *v = int16V(o.(IntValue).Get(t));
-}
+func (v *int16V) Assign(t *Thread, o Value)    { *v = int16V(o.(IntValue).Get(t)) }
 
-func (v *int16V) Get(*Thread) int64 {
-       return int64(*v);
-}
+func (v *int16V) Get(*Thread) int64    { return int64(*v) }
 
-func (v *int16V) Set(t *Thread, x int64) {
-       *v = int16V(x);
-}
+func (v *int16V) Set(t *Thread, x int64)       { *v = int16V(x) }
 
 type int32V int32
 
-func (v *int32V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *int32V) String() string       { return fmt.Sprint(*v) }
 
-func (v *int32V) Assign(t *Thread, o Value) {
-       *v = int32V(o.(IntValue).Get(t));
-}
+func (v *int32V) Assign(t *Thread, o Value)    { *v = int32V(o.(IntValue).Get(t)) }
 
-func (v *int32V) Get(*Thread) int64 {
-       return int64(*v);
-}
+func (v *int32V) Get(*Thread) int64    { return int64(*v) }
 
-func (v *int32V) Set(t *Thread, x int64) {
-       *v = int32V(x);
-}
+func (v *int32V) Set(t *Thread, x int64)       { *v = int32V(x) }
 
 type int64V int64
 
-func (v *int64V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *int64V) String() string       { return fmt.Sprint(*v) }
 
-func (v *int64V) Assign(t *Thread, o Value) {
-       *v = int64V(o.(IntValue).Get(t));
-}
+func (v *int64V) Assign(t *Thread, o Value)    { *v = int64V(o.(IntValue).Get(t)) }
 
-func (v *int64V) Get(*Thread) int64 {
-       return int64(*v);
-}
+func (v *int64V) Get(*Thread) int64    { return int64(*v) }
 
-func (v *int64V) Set(t *Thread, x int64) {
-       *v = int64V(x);
-}
+func (v *int64V) Set(t *Thread, x int64)       { *v = int64V(x) }
 
 type intV int
 
-func (v *intV) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *intV) String() string { return fmt.Sprint(*v) }
 
-func (v *intV) Assign(t *Thread, o Value) {
-       *v = intV(o.(IntValue).Get(t));
-}
+func (v *intV) Assign(t *Thread, o Value)      { *v = intV(o.(IntValue).Get(t)) }
 
-func (v *intV) Get(*Thread) int64 {
-       return int64(*v);
-}
+func (v *intV) Get(*Thread) int64      { return int64(*v) }
 
-func (v *intV) Set(t *Thread, x int64) {
-       *v = intV(x);
-}
+func (v *intV) Set(t *Thread, x int64) { *v = intV(x) }
 
 /*
  * Ideal int
@@ -371,17 +275,13 @@ type idealIntV struct {
        V *bignum.Integer;
 }
 
-func (v *idealIntV) String() string {
-       return v.V.String();
-}
+func (v *idealIntV) String() string    { return v.V.String() }
 
 func (v *idealIntV) Assign(t *Thread, o Value) {
        v.V = o.(IdealIntValue).Get();
 }
 
-func (v *idealIntV) Get() *bignum.Integer {
-       return v.V;
-}
+func (v *idealIntV) Get() *bignum.Integer      { return v.V }
 
 /*
  * Float
@@ -389,57 +289,33 @@ func (v *idealIntV) Get() *bignum.Integer {
 
 type float32V float32
 
-func (v *float32V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *float32V) String() string     { return fmt.Sprint(*v) }
 
-func (v *float32V) Assign(t *Thread, o Value) {
-       *v = float32V(o.(FloatValue).Get(t));
-}
+func (v *float32V) Assign(t *Thread, o Value)  { *v = float32V(o.(FloatValue).Get(t)) }
 
-func (v *float32V) Get(*Thread) float64 {
-       return float64(*v);
-}
+func (v *float32V) Get(*Thread) float64        { return float64(*v) }
 
-func (v *float32V) Set(t *Thread, x float64) {
-       *v = float32V(x);
-}
+func (v *float32V) Set(t *Thread, x float64)   { *v = float32V(x) }
 
 type float64V float64
 
-func (v *float64V) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *float64V) String() string     { return fmt.Sprint(*v) }
 
-func (v *float64V) Assign(t *Thread, o Value) {
-       *v = float64V(o.(FloatValue).Get(t));
-}
+func (v *float64V) Assign(t *Thread, o Value)  { *v = float64V(o.(FloatValue).Get(t)) }
 
-func (v *float64V) Get(*Thread) float64 {
-       return float64(*v);
-}
+func (v *float64V) Get(*Thread) float64        { return float64(*v) }
 
-func (v *float64V) Set(t *Thread, x float64) {
-       *v = float64V(x);
-}
+func (v *float64V) Set(t *Thread, x float64)   { *v = float64V(x) }
 
 type floatV float
 
-func (v *floatV) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *floatV) String() string       { return fmt.Sprint(*v) }
 
-func (v *floatV) Assign(t *Thread, o Value) {
-       *v = floatV(o.(FloatValue).Get(t));
-}
+func (v *floatV) Assign(t *Thread, o Value)    { *v = floatV(o.(FloatValue).Get(t)) }
 
-func (v *floatV) Get(*Thread) float64 {
-       return float64(*v);
-}
+func (v *floatV) Get(*Thread) float64  { return float64(*v) }
 
-func (v *floatV) Set(t *Thread, x float64) {
-       *v = floatV(x);
-}
+func (v *floatV) Set(t *Thread, x float64)     { *v = floatV(x) }
 
 /*
  * Ideal float
@@ -449,17 +325,13 @@ type idealFloatV struct {
        V *bignum.Rational;
 }
 
-func (v *idealFloatV) String() string {
-       return ratToString(v.V);
-}
+func (v *idealFloatV) String() string  { return ratToString(v.V) }
 
 func (v *idealFloatV) Assign(t *Thread, o Value) {
        v.V = o.(IdealFloatValue).Get();
 }
 
-func (v *idealFloatV) Get() *bignum.Rational {
-       return v.V;
-}
+func (v *idealFloatV) Get() *bignum.Rational   { return v.V }
 
 /*
  * String
@@ -467,21 +339,13 @@ func (v *idealFloatV) Get() *bignum.Rational {
 
 type stringV string
 
-func (v *stringV) String() string {
-       return fmt.Sprint(*v);
-}
+func (v *stringV) String() string      { return fmt.Sprint(*v) }
 
-func (v *stringV) Assign(t *Thread, o Value) {
-       *v = stringV(o.(StringValue).Get(t));
-}
+func (v *stringV) Assign(t *Thread, o Value)   { *v = stringV(o.(StringValue).Get(t)) }
 
-func (v *stringV) Get(*Thread) string {
-       return string(*v);
-}
+func (v *stringV) Get(*Thread) string  { return string(*v) }
 
-func (v *stringV) Set(t *Thread, x string) {
-       *v = stringV(x);
-}
+func (v *stringV) Set(t *Thread, x string)     { *v = stringV(x) }
 
 /*
  * Array
@@ -508,9 +372,7 @@ func (v *arrayV) Assign(t *Thread, o Value) {
        }
 }
 
-func (v *arrayV) Get(*Thread) ArrayValue {
-       return v;
-}
+func (v *arrayV) Get(*Thread) ArrayValue       { return v }
 
 func (v *arrayV) Elem(t *Thread, i int64) Value {
        return (*v)[i];
@@ -548,9 +410,7 @@ func (v *structV) Assign(t *Thread, o Value) {
        }
 }
 
-func (v *structV) Get(*Thread) StructValue {
-       return v;
-}
+func (v *structV) Get(*Thread) StructValue     { return v }
 
 func (v *structV) Field(t *Thread, i int) Value {
        return (*v)[i];
@@ -572,17 +432,11 @@ func (v *ptrV) String() string {
        return "&" + v.target.String();
 }
 
-func (v *ptrV) Assign(t *Thread, o Value) {
-       v.target = o.(PtrValue).Get(t);
-}
+func (v *ptrV) Assign(t *Thread, o Value)      { v.target = o.(PtrValue).Get(t) }
 
-func (v *ptrV) Get(*Thread) Value {
-       return v.target;
-}
+func (v *ptrV) Get(*Thread) Value      { return v.target }
 
-func (v *ptrV) Set(t *Thread, x Value) {
-       v.target = x;
-}
+func (v *ptrV) Set(t *Thread, x Value) { v.target = x }
 
 /*
  * Functions
@@ -597,17 +451,11 @@ func (v *funcV) String() string {
        return "func {...}";
 }
 
-func (v *funcV) Assign(t *Thread, o Value) {
-       v.target = o.(FuncValue).Get(t);
-}
+func (v *funcV) Assign(t *Thread, o Value)     { v.target = o.(FuncValue).Get(t) }
 
-func (v *funcV) Get(*Thread) Func {
-       return v.target;
-}
+func (v *funcV) Get(*Thread) Func      { return v.target }
 
-func (v *funcV) Set(t *Thread, x Func) {
-       v.target = x;
-}
+func (v *funcV) Set(t *Thread, x Func) { v.target = x }
 
 /*
  * Interfaces
@@ -628,9 +476,7 @@ func (v *interfaceV) Assign(t *Thread, o Value) {
        v.Interface = o.(InterfaceValue).Get(t);
 }
 
-func (v *interfaceV) Get(*Thread) Interface {
-       return v.Interface;
-}
+func (v *interfaceV) Get(*Thread) Interface    { return v.Interface }
 
 func (v *interfaceV) Set(t *Thread, x Interface) {
        v.Interface = x;
@@ -651,17 +497,11 @@ func (v *sliceV) String() string {
        return v.Base.Sub(0, v.Len).String();
 }
 
-func (v *sliceV) Assign(t *Thread, o Value) {
-       v.Slice = o.(SliceValue).Get(t);
-}
+func (v *sliceV) Assign(t *Thread, o Value)    { v.Slice = o.(SliceValue).Get(t) }
 
-func (v *sliceV) Get(*Thread) Slice {
-       return v.Slice;
-}
+func (v *sliceV) Get(*Thread) Slice    { return v.Slice }
 
-func (v *sliceV) Set(t *Thread, x Slice) {
-       v.Slice = x;
-}
+func (v *sliceV) Set(t *Thread, x Slice)       { v.Slice = x }
 
 /*
  * Maps
@@ -688,23 +528,15 @@ func (v *mapV) String() string {
        return res+"]";
 }
 
-func (v *mapV) Assign(t *Thread, o Value) {
-       v.target = o.(MapValue).Get(t);
-}
+func (v *mapV) Assign(t *Thread, o Value)      { v.target = o.(MapValue).Get(t) }
 
-func (v *mapV) Get(*Thread) Map {
-       return v.target;
-}
+func (v *mapV) Get(*Thread) Map        { return v.target }
 
-func (v *mapV) Set(t *Thread, x Map) {
-       v.target = x;
-}
+func (v *mapV) Set(t *Thread, x Map)   { v.target = x }
 
 type evalMap map[interface{}]Value
 
-func (m evalMap) Len(t *Thread) int64 {
-       return int64(len(m));
-}
+func (m evalMap) Len(t *Thread) int64  { return int64(len(m)) }
 
 func (m evalMap) Elem(t *Thread, key interface{}) Value {
        if v, ok := m[key]; ok {
index bf9af22abd1a6011d288296860f4e37126e6396f..8218c24f5be98bf9b446d462c6b7449dc7aedc69 100644 (file)
@@ -81,9 +81,7 @@ func (w *World) CompileDeclList(decls []ast.Decl) (Code, os.Error) {
        return w.CompileStmtList(stmts);
 }
 
-func (s *stmtCode) Type() Type {
-       return nil;
-}
+func (s *stmtCode) Type() Type { return nil }
 
 func (s *stmtCode) Run() (Value, os.Error) {
        t := new(Thread);
@@ -120,9 +118,7 @@ func (w *World) CompileExpr(e ast.Expr) (Code, os.Error) {
        return &exprCode{w, ec, eval}, nil;
 }
 
-func (e *exprCode) Type() Type {
-       return e.e.t;
-}
+func (e *exprCode) Type() Type { return e.e.t }
 
 func (e *exprCode) Run() (Value, os.Error) {
        t := new(Thread);
index bc66ff5ddebf0c7e42b751b7141b1c8d7533cc2d..fbb24f7b6e3d6004ba646750697f1db2a525e76d 100644 (file)
@@ -23,24 +23,12 @@ func (arr IntArray) Iter() <-chan interface{} {
 
 var oneToFive = IntArray{1, 2, 3, 4, 5}
 
-func isNegative(n interface{}) bool {
-       return n.(int) < 0;
-}
-func isPositive(n interface{}) bool {
-       return n.(int) > 0;
-}
-func isAbove3(n interface{}) bool {
-       return n.(int) > 3;
-}
-func isEven(n interface{}) bool {
-       return n.(int) % 2 == 0;
-}
-func doubler(n interface{}) interface{} {
-       return n.(int) * 2;
-}
-func addOne(n interface{}) interface{} {
-       return n.(int) + 1;
-}
+func isNegative(n interface{}) bool    { return n.(int) < 0 }
+func isPositive(n interface{}) bool    { return n.(int) > 0 }
+func isAbove3(n interface{}) bool      { return n.(int) > 3 }
+func isEven(n interface{}) bool                { return n.(int) % 2 == 0 }
+func doubler(n interface{}) interface{}        { return n.(int) * 2 }
+func addOne(n interface{}) interface{} { return n.(int) + 1 }
 func adder(acc interface{}, n interface{}) interface{} {
        return acc.(int) + n.(int);
 }
index 4c63125527bec4ff2f8c169af1b7355d5a09ef50..12801c631edf95ea9f5cbc5ad4514ac26de22cb8 100644 (file)
@@ -54,25 +54,17 @@ type Window struct {
 // *Window implements draw.Context
 var _ draw.Context = (*Window)(nil)
 
-func (w *Window) KeyboardChan() <-chan int {
-       return w.kbdc;
-}
+func (w *Window) KeyboardChan() <-chan int     { return w.kbdc }
 
 func (w *Window) MouseChan() <-chan draw.Mouse {
        return w.mousec;
 }
 
-func (w *Window) QuitChan() <-chan bool {
-       return w.quitc;
-}
+func (w *Window) QuitChan() <-chan bool        { return w.quitc }
 
-func (w *Window) ResizeChan() <-chan bool {
-       return w.resizec;
-}
+func (w *Window) ResizeChan() <-chan bool      { return w.resizec }
 
-func (w *Window) Screen() draw.Image {
-       return w.Image;
-}
+func (w *Window) Screen() draw.Image   { return w.Image }
 
 // Init initializes the Native Client subsystems specified by subsys.
 // Init must be called before using any of the other functions
@@ -223,9 +215,7 @@ var bridge struct {
 // so this blocks.  Once the bridge is ready, multimediaBridge.Run
 // will drop a value into the channel.  Then any calls
 // to waitBridge will finish, taking the value out and immediately putting it back.
-func waitBridge() {
-       bridge.c <- <-bridge.c;
-}
+func waitBridge()      { bridge.c <- <-bridge.c }
 
 const eqsize = 64
 
index 8bc8fd07b3902623f364088cf98e67de7f16be0f..e92ca8aeb2afd7454a569e0401c136107308df1c 100644 (file)
@@ -22,9 +22,7 @@ type Image struct {
 
 var _ image.Image = (*Image)(nil)
 
-func (m *Image) ColorModel() image.ColorModel {
-       return ColorModel;
-}
+func (m *Image) ColorModel() image.ColorModel  { return ColorModel }
 
 func (m *Image) Width() int {
        if len(m.Pixel) == 0 {
@@ -33,13 +31,9 @@ func (m *Image) Width() int {
        return len(m.Pixel[0]);
 }
 
-func (m *Image) Height() int {
-       return len(m.Pixel);
-}
+func (m *Image) Height() int   { return len(m.Pixel) }
 
-func (m *Image) At(x, y int) image.Color {
-       return m.Pixel[y][x];
-}
+func (m *Image) At(x, y int) image.Color       { return m.Pixel[y][x] }
 
 func (m *Image) Set(x, y int, color image.Color) {
        if c, ok := color.(Color); ok {
index b0c8041a53bd72d3f488881127245acf1a9e7019..e6ab4aa8fc17cfec58758b39c1c782f090b32d97 100644 (file)
@@ -226,9 +226,7 @@ func (m *msg) grow(n int) []byte {
        return m.wdata[i : i+n];
 }
 
-func (m *msg) wuint8(x uint8) {
-       m.grow(1)[0] = x;
-}
+func (m *msg) wuint8(x uint8)  { m.grow(1)[0] = x }
 
 func (m *msg) wuint32(x uint32) {
        b := m.grow(4);
@@ -252,9 +250,7 @@ func (m *msg) wuint64(x uint64) {
        b[7] = byte(hi>>24);
 }
 
-func (m *msg) wbytes(p []byte) {
-       bytes.Copy(m.grow(len(p)), p);
-}
+func (m *msg) wbytes(p []byte) { bytes.Copy(m.grow(len(p)), p) }
 
 func (m *msg) wstring(s string) {
        b := m.grow(len(s));
index 984aebeea9df48ffd554dc36970b5e0238d9d45b..87b51a6f49800d1ac329bbb59e68f977a5f762e1 100644 (file)
@@ -198,6 +198,4 @@ func (serviceDiscovery) Run(arg, ret []interface{}, size []int) Errno {
        return OK;
 }
 
-func init() {
-       Add("service_discovery", ":C", serviceDiscovery{});
-}
+func init()    { Add("service_discovery", ":C", serviceDiscovery{}) }
index 16ed4728c549fd48fa6719cd9783551c9519457f..20ce9f66607a47dd37dce6fcd8333ebe61079abd 100644 (file)
@@ -74,17 +74,11 @@ func (ArchLSB) ToFloat32(bits uint32) float32 {
        return math.Float32frombits(bits);
 }
 
-func (ArchLSB) FromFloat32(f float32) uint32 {
-       return math.Float32bits(f);
-}
+func (ArchLSB) FromFloat32(f float32) uint32   { return math.Float32bits(f) }
 
-func (ArchLSB) ToFloat64(bits uint64) float64 {
-       return math.Float64frombits(bits);
-}
+func (ArchLSB) ToFloat64(bits uint64) float64  { return math.Float64frombits(bits) }
 
-func (ArchLSB) FromFloat64(f float64) uint64 {
-       return math.Float64bits(f);
-}
+func (ArchLSB) FromFloat64(f float64) uint64   { return math.Float64bits(f) }
 
 type ArchAlignedMultiple struct{}
 
@@ -98,17 +92,11 @@ type amd64 struct {
        gReg    int;
 }
 
-func (a *amd64) IntSize() int {
-       return 4;
-}
+func (a *amd64) IntSize() int  { return 4 }
 
-func (a *amd64) PtrSize() int {
-       return 8;
-}
+func (a *amd64) PtrSize() int  { return 8 }
 
-func (a *amd64) FloatSize() int {
-       return 4;
-}
+func (a *amd64) FloatSize() int        { return 4 }
 
 func (a *amd64) G(regs proc.Regs) proc.Word {
        // See src/pkg/runtime/mkasmh
@@ -125,9 +113,7 @@ func (a *amd64) G(regs proc.Regs) proc.Word {
        return regs.Get(a.gReg);
 }
 
-func (a *amd64) ClosureSize() int {
-       return 8;
-}
+func (a *amd64) ClosureSize() int      { return 8 }
 
 func (a *amd64) ParseClosure(data []byte) (int, bool) {
        if data[0] == 0x48 && data[1] == 0x81 && data[2] == 0xc4 && data[7] == 0xc3 {
index 4805c924370f29e9cce072e85ac0b01968d21cac..4df546a27a3be1508c168373a89ce3b800ee863b 100644 (file)
@@ -76,9 +76,7 @@ func newScanner(input []byte) (*scanner.Scanner, *scanner.ErrorVector) {
 // A UsageError occurs when a command is called with illegal arguments.
 type UsageError string
 
-func (e UsageError) String() string {
-       return string(e);
-}
+func (e UsageError) String() string    { return string(e) }
 
 // A cmd represents a single command with a handler.
 type cmd struct {
@@ -325,8 +323,7 @@ func printCurFrame() {
 }
 
 // fnOut moves the current frame to the caller of the current frame.
-func fnOutSig() {
-}
+func fnOutSig()        {}
 func fnOut(t *eval.Thread, args []eval.Value, res []eval.Value) {
        if curProc == nil {
                t.Abort(NoCurrentGoroutine{});
@@ -340,8 +337,7 @@ func fnOut(t *eval.Thread, args []eval.Value, res []eval.Value) {
 }
 
 // fnContWait continues the current process and waits for a stopping event.
-func fnContWaitSig() {
-}
+func fnContWaitSig()   {}
 func fnContWait(t *eval.Thread, args []eval.Value, res []eval.Value) {
        if curProc == nil {
                t.Abort(NoCurrentGoroutine{});
@@ -359,8 +355,7 @@ func fnContWait(t *eval.Thread, args []eval.Value, res []eval.Value) {
 }
 
 // fnBpSet sets a breakpoint at the entry to the named function.
-func fnBpSetSig(string) {
-}
+func fnBpSetSig(string)        {}
 func fnBpSet(t *eval.Thread, args []eval.Value, res []eval.Value) {
        // TODO(austin) This probably shouldn't take a symbol name.
        // Perhaps it should take an interface that provides PC's.
index c66c791e2e506eb7a3850263fecc19e2f1c1cc22..898ab2762af42fc7c0bc200ee798be08269943c3 100644 (file)
@@ -114,9 +114,7 @@ func (h *commonHook) RemoveHandler(eh EventHandler) {
        }
 }
 
-func (h *commonHook) NumHandler() int {
-       return h.len;
-}
+func (h *commonHook) NumHandler() int  { return h.len }
 
 func (h *commonHook) handle(e Event) (EventAction, os.Error) {
        action := EADefault;
@@ -151,13 +149,9 @@ type commonEvent struct {
        t       *Goroutine;
 }
 
-func (e *commonEvent) Process() *Process {
-       return e.p;
-}
+func (e *commonEvent) Process() *Process       { return e.p }
 
-func (e *commonEvent) Goroutine() *Goroutine {
-       return e.t;
-}
+func (e *commonEvent) Goroutine() *Goroutine   { return e.t }
 
 /*
  * Standard event handlers
@@ -229,9 +223,7 @@ func (h *breakpointHook) String() string {
        return fmt.Sprintf("breakpoint at %#x", h.pc);
 }
 
-func (b *Breakpoint) PC() proc.Word {
-       return b.pc;
-}
+func (b *Breakpoint) PC() proc.Word    { return b.pc }
 
 func (b *Breakpoint) String() string {
        // TODO(austin) Include process name and goroutine
@@ -247,9 +239,7 @@ type goroutineCreateHook struct {
        commonHook;
 }
 
-func (h *goroutineCreateHook) String() string {
-       return "goroutine create";
-}
+func (h *goroutineCreateHook) String() string  { return "goroutine create" }
 
 // A GoroutineCreate event occurs when a process creates a new
 // goroutine.  When this event is handled, the current goroutine will
@@ -261,9 +251,7 @@ type GoroutineCreate struct {
 
 // Parent returns the goroutine that created this goroutine.  May be
 // nil if this event is the creation of the first goroutine.
-func (e *GoroutineCreate) Parent() *Goroutine {
-       return e.parent;
-}
+func (e *GoroutineCreate) Parent() *Goroutine  { return e.parent }
 
 func (e *GoroutineCreate) String() string {
        // TODO(austin) Include process name
@@ -277,9 +265,7 @@ type goroutineExitHook struct {
        commonHook;
 }
 
-func (h *goroutineExitHook) String() string {
-       return "goroutine exit";
-}
+func (h *goroutineExitHook) String() string    { return "goroutine exit" }
 
 // A GoroutineExit event occurs when a Go goroutine exits.
 type GoroutineExit struct {
index d7fae6856f0506023ec9228db0b6ffa87d7a25cd..a0ba71e74b6833f24d378816a700f185b620fd16 100644 (file)
@@ -201,9 +201,7 @@ func (f *Frame) aOuter(a aborter) *Frame {
 
 // Inner returns the Frame called by this Frame, or nil if this is the
 // innermost frame.
-func (f *Frame) Inner() *Frame {
-       return f.inner;
-}
+func (f *Frame) Inner() *Frame { return f.inner }
 
 func (f *Frame) String() string {
        res := f.fn.Name;
index ad1b893342ad6163a183ec4b49d53f0662d7fa79..683b70d19572f7d0a4bee4f19f7232160924e503 100644 (file)
@@ -28,9 +28,7 @@ func (t *Goroutine) String() string {
 }
 
 // isG0 returns true if this thread if the internal idle thread
-func (t *Goroutine) isG0() bool {
-       return t.g.addr().base == t.g.r.p.sys.g0.addr().base;
-}
+func (t *Goroutine) isG0() bool        { return t.g.addr().base == t.g.r.p.sys.g0.addr().base }
 
 func (t *Goroutine) resetFrame() (err os.Error) {
        // TODO(austin) Reuse any live part of the current frame stack
index 88265624a64a8485a7eb894fff5d8d1c1b94a7e1..39e00297816582c37b54ba1bb7bed3b8ed26aceb 100644 (file)
@@ -6,6 +6,4 @@ package main
 
 import "exp/ogle"
 
-func main() {
-       ogle.Main();
-}
+func main()    { ogle.Main() }
index 07074992b3ebb09c89bc9faf1b84aca45f20b82c..b2efbcd468e23fed95056bbdefb2e099438ad358 100644 (file)
@@ -20,9 +20,7 @@ import (
 // in the object file or runtime structures.
 type FormatError string
 
-func (e FormatError) String() string {
-       return string(e);
-}
+func (e FormatError) String() string   { return string(e) }
 
 // An UnknownArchitecture occurs when trying to load an object file
 // that indicates an architecture not supported by the debugger.
@@ -36,9 +34,7 @@ func (e UnknownArchitecture) String() string {
 // memory or registers of a process that is not stopped.
 type ProcessNotStopped struct{}
 
-func (e ProcessNotStopped) String() string {
-       return "process not stopped";
-}
+func (e ProcessNotStopped) String() string     { return "process not stopped" }
 
 // An UnknownGoroutine error is an internal error representing an
 // unrecognized G structure pointer.
@@ -56,9 +52,7 @@ func (e UnknownGoroutine) String() string {
 // process).
 type NoCurrentGoroutine struct{}
 
-func (e NoCurrentGoroutine) String() string {
-       return "no current goroutine";
-}
+func (e NoCurrentGoroutine) String() string    { return "no current goroutine" }
 
 // A Process represents a remote attached process.
 type Process struct {
@@ -338,9 +332,7 @@ func (p *Process) OnGoroutineCreate() EventHook {
 }
 
 // OnGoroutineExit returns the hook that is run when a goroutine exits.
-func (p *Process) OnGoroutineExit() EventHook {
-       return p.goroutineExitHook;
-}
+func (p *Process) OnGoroutineExit() EventHook  { return p.goroutineExitHook }
 
 // osThreadToGoroutine looks up the goroutine running on an OS thread.
 func (p *Process) osThreadToGoroutine(t proc.Thread) (*Goroutine, os.Error) {
@@ -475,9 +467,7 @@ func (p *Process) processEvent(ev Event) (EventAction, os.Error) {
 // may return nil if the process has never been stopped by an event.
 //
 // TODO(austin) Return nil if the user calls p.Stop()?
-func (p *Process) Event() Event {
-       return p.event;
-}
+func (p *Process) Event() Event        { return p.event }
 
 /*
  * Process control
index 6d890fc929d346cdadd254462adbd2d847cbe13c..0b05b1120e058e900ae8446c1009fd80dc2ce7bb 100644 (file)
@@ -144,9 +144,7 @@ func parseRemoteType(a aborter, rs remoteStruct) *remoteType {
                }
                log.Stderrf("%sParsing type at %#x (%s)", prtIndent, addr, name);
                prtIndent += " ";
-               defer func() {
-                       prtIndent = prtIndent[0 : len(prtIndent)-1];
-               }();
+               defer func() { prtIndent = prtIndent[0 : len(prtIndent)-1] }();
        }
 
        // Get Type header
index 1cfd8f78fe1a794870b454911bb24fcac4bd958c..a01512ace6346cef0771aef20892e97ee58a0468 100644 (file)
@@ -16,17 +16,13 @@ import (
 // point to something in another process.
 type RemoteMismatchError string
 
-func (e RemoteMismatchError) String() string {
-       return string(e);
-}
+func (e RemoteMismatchError) String() string   { return string(e) }
 
 // A ReadOnlyError occurs when attempting to set or assign to a
 // read-only value.
 type ReadOnlyError string
 
-func (e ReadOnlyError) String() string {
-       return string(e);
-}
+func (e ReadOnlyError) String() string { return string(e) }
 
 // A maker is a function that converts a remote address into an
 // interpreter Value.
@@ -78,9 +74,7 @@ func (v remote) Set(a aborter, size int, x uint64) {
        }
 }
 
-func (v remote) plus(x proc.Word) remote {
-       return remote{v.base + x, v.p};
-}
+func (v remote) plus(x proc.Word) remote       { return remote{v.base + x, v.p} }
 
 func tryRVString(f func(a aborter) string) string {
        var s string;
@@ -107,13 +101,9 @@ func (v remoteBool) Assign(t *eval.Thread, o eval.Value) {
        v.Set(t, o.(eval.BoolValue).Get(t));
 }
 
-func (v remoteBool) Get(t *eval.Thread) bool {
-       return v.aGet(t);
-}
+func (v remoteBool) Get(t *eval.Thread) bool   { return v.aGet(t) }
 
-func (v remoteBool) aGet(a aborter) bool {
-       return v.r.Get(a, 1) != 0;
-}
+func (v remoteBool) aGet(a aborter) bool       { return v.r.Get(a, 1) != 0 }
 
 func (v remoteBool) Set(t *eval.Thread, x bool) {
        v.aSet(t, x);
@@ -127,13 +117,9 @@ func (v remoteBool) aSet(a aborter, x bool) {
        }
 }
 
-func (v remoteBool) addr() remote {
-       return v.r;
-}
+func (v remoteBool) addr() remote      { return v.r }
 
-func mkBool(r remote) eval.Value {
-       return remoteBool{r};
-}
+func mkBool(r remote) eval.Value       { return remoteBool{r} }
 
 /*
  * Uint
@@ -156,45 +142,27 @@ func (v remoteUint) Get(t *eval.Thread) uint64 {
        return v.aGet(t);
 }
 
-func (v remoteUint) aGet(a aborter) uint64 {
-       return v.r.Get(a, v.size);
-}
+func (v remoteUint) aGet(a aborter) uint64     { return v.r.Get(a, v.size) }
 
 func (v remoteUint) Set(t *eval.Thread, x uint64) {
        v.aSet(t, x);
 }
 
-func (v remoteUint) aSet(a aborter, x uint64) {
-       v.r.Set(a, v.size, x);
-}
+func (v remoteUint) aSet(a aborter, x uint64)  { v.r.Set(a, v.size, x) }
 
-func (v remoteUint) addr() remote {
-       return v.r;
-}
+func (v remoteUint) addr() remote      { return v.r }
 
-func mkUint8(r remote) eval.Value {
-       return remoteUint{r, 1};
-}
+func mkUint8(r remote) eval.Value      { return remoteUint{r, 1} }
 
-func mkUint16(r remote) eval.Value {
-       return remoteUint{r, 2};
-}
+func mkUint16(r remote) eval.Value     { return remoteUint{r, 2} }
 
-func mkUint32(r remote) eval.Value {
-       return remoteUint{r, 4};
-}
+func mkUint32(r remote) eval.Value     { return remoteUint{r, 4} }
 
-func mkUint64(r remote) eval.Value {
-       return remoteUint{r, 8};
-}
+func mkUint64(r remote) eval.Value     { return remoteUint{r, 8} }
 
-func mkUint(r remote) eval.Value {
-       return remoteUint{r, r.p.IntSize()};
-}
+func mkUint(r remote) eval.Value       { return remoteUint{r, r.p.IntSize()} }
 
-func mkUintptr(r remote) eval.Value {
-       return remoteUint{r, r.p.PtrSize()};
-}
+func mkUintptr(r remote) eval.Value    { return remoteUint{r, r.p.PtrSize()} }
 
 /*
  * Int
@@ -213,45 +181,27 @@ func (v remoteInt) Assign(t *eval.Thread, o eval.Value) {
        v.Set(t, o.(eval.IntValue).Get(t));
 }
 
-func (v remoteInt) Get(t *eval.Thread) int64 {
-       return v.aGet(t);
-}
+func (v remoteInt) Get(t *eval.Thread) int64   { return v.aGet(t) }
 
-func (v remoteInt) aGet(a aborter) int64 {
-       return int64(v.r.Get(a, v.size));
-}
+func (v remoteInt) aGet(a aborter) int64       { return int64(v.r.Get(a, v.size)) }
 
 func (v remoteInt) Set(t *eval.Thread, x int64) {
        v.aSet(t, x);
 }
 
-func (v remoteInt) aSet(a aborter, x int64) {
-       v.r.Set(a, v.size, uint64(x));
-}
+func (v remoteInt) aSet(a aborter, x int64)    { v.r.Set(a, v.size, uint64(x)) }
 
-func (v remoteInt) addr() remote {
-       return v.r;
-}
+func (v remoteInt) addr() remote       { return v.r }
 
-func mkInt8(r remote) eval.Value {
-       return remoteInt{r, 1};
-}
+func mkInt8(r remote) eval.Value       { return remoteInt{r, 1} }
 
-func mkInt16(r remote) eval.Value {
-       return remoteInt{r, 2};
-}
+func mkInt16(r remote) eval.Value      { return remoteInt{r, 2} }
 
-func mkInt32(r remote) eval.Value {
-       return remoteInt{r, 4};
-}
+func mkInt32(r remote) eval.Value      { return remoteInt{r, 4} }
 
-func mkInt64(r remote) eval.Value {
-       return remoteInt{r, 8};
-}
+func mkInt64(r remote) eval.Value      { return remoteInt{r, 8} }
 
-func mkInt(r remote) eval.Value {
-       return remoteInt{r, r.p.IntSize()};
-}
+func mkInt(r remote) eval.Value        { return remoteInt{r, r.p.IntSize()} }
 
 /*
  * Float
@@ -302,21 +252,13 @@ func (v remoteFloat) aSet(a aborter, x float64) {
        v.r.Set(a, v.size, bits);
 }
 
-func (v remoteFloat) addr() remote {
-       return v.r;
-}
+func (v remoteFloat) addr() remote     { return v.r }
 
-func mkFloat32(r remote) eval.Value {
-       return remoteFloat{r, 4};
-}
+func mkFloat32(r remote) eval.Value    { return remoteFloat{r, 4} }
 
-func mkFloat64(r remote) eval.Value {
-       return remoteFloat{r, 8};
-}
+func mkFloat64(r remote) eval.Value    { return remoteFloat{r, 8} }
 
-func mkFloat(r remote) eval.Value {
-       return remoteFloat{r, r.p.FloatSize()};
-}
+func mkFloat(r remote) eval.Value      { return remoteFloat{r, r.p.FloatSize()} }
 
 /*
  * String
@@ -361,9 +303,7 @@ func (v remoteString) aSet(a aborter, x string) {
        a.Abort(ReadOnlyError("remote strings cannot be assigned to"));
 }
 
-func mkString(r remote) eval.Value {
-       return remoteString{r};
-}
+func mkString(r remote) eval.Value     { return remoteString{r} }
 
 /*
  * Array
@@ -458,9 +398,7 @@ func (v remoteStruct) field(i int) eval.Value {
        return f.fieldType.mk(v.r.plus(proc.Word(f.offset)));
 }
 
-func (v remoteStruct) addr() remote {
-       return v.r;
-}
+func (v remoteStruct) addr() remote    { return v.r }
 
 /*
  * Pointer
@@ -517,9 +455,7 @@ func (v remotePtr) aSet(a aborter, x eval.Value) {
        v.r.Set(a, v.r.p.PtrSize(), uint64(xr.addr().base));
 }
 
-func (v remotePtr) addr() remote {
-       return v.r;
-}
+func (v remotePtr) addr() remote       { return v.r }
 
 /*
  * Slice
index 58ddbff161f3c902285598f9cc29d22836f7892e..74d540ce90fe0052daed0fc7440a700ed6eb02ea 100644 (file)
@@ -90,9 +90,7 @@ type remotePackage struct {
        defs []eval.Value;
 }
 
-func (v remotePackage) String() string {
-       return "<remote package>";
-}
+func (v remotePackage) String() string { return "<remote package>" }
 
 func (v remotePackage) Assign(t *eval.Thread, o eval.Value) {
        t.Abort(ReadOnlyError("remote packages cannot be assigned to"));
@@ -208,9 +206,7 @@ func (p *Process) typeOfSym(s *gosym.Sym) (*remoteType, os.Error) {
        }
        addr := proc.Word(s.GoType);
        var rt *remoteType;
-       err := try(func(a aborter) {
-               rt = parseRemoteType(a, p.runtime.Type.mk(remote{addr, p}).(remoteStruct));
-       });
+       err := try(func(a aborter) { rt = parseRemoteType(a, p.runtime.Type.mk(remote{addr, p}).(remoteStruct)) });
        if err != nil {
                return nil, err;
        }
index ddffe7f40a4d99bba608be04ba243137cf9f314e..02c3717e9c07136ad2110b4ae40f42c548ab7f7a 100644 (file)
@@ -158,9 +158,7 @@ func (e HaltError) String() string {
 
 type LoopError Word
 
-func (e LoopError) String() string {
-       return fmt.Sprintf("indirect load looping at %06o", e);
-}
+func (e LoopError) String() string     { return fmt.Sprintf("indirect load looping at %06o", e) }
 
 func (m *M) run(inst Word, t Trapper) os.Error {
        ib, y := (inst>>12)&1, inst&07777;
index 9a975fc1f19f88afd05431894a52db0634bf55af..0c85df84439916b169f4ad3bcd8a61e627fa984f 100644 (file)
@@ -27,9 +27,7 @@ type Int struct {
        mu      sync.Mutex;
 }
 
-func (v *Int) String() string {
-       return strconv.Itoa64(v.i);
-}
+func (v *Int) String() string  { return strconv.Itoa64(v.i) }
 
 func (v *Int) Add(delta int64) {
        v.mu.Lock();
@@ -120,21 +118,15 @@ type String struct {
        s string;
 }
 
-func (v *String) String() string {
-       return strconv.Quote(v.s);
-}
+func (v *String) String() string       { return strconv.Quote(v.s) }
 
-func (v *String) Set(value string) {
-       v.s = value;
-}
+func (v *String) Set(value string)     { v.s = value }
 
 // IntFunc wraps a func() int64 to create a value that satisfies the Var interface.
 // The function will be called each time the Var is evaluated.
 type IntFunc func() int64
 
-func (v IntFunc) String() string {
-       return strconv.Itoa64(v());
-}
+func (v IntFunc) String() string       { return strconv.Itoa64(v()) }
 
 
 // All published variables.
@@ -217,6 +209,4 @@ func expvarHandler(c *http.Conn, req *http.Request) {
        fmt.Fprintf(c, "\n}\n");
 }
 
-func init() {
-       http.Handle("/debug/vars", http.HandlerFunc(expvarHandler));
-}
+func init()    { http.Handle("/debug/vars", http.HandlerFunc(expvarHandler)) }
index 5dc698ce205c94b692f132793b8919f61bd3afcd..1f5f6434ae00000120b3b85fdfc08a1f22f4e9a7 100644 (file)
@@ -75,9 +75,7 @@ func (b *boolValue) set(s string) bool {
        return ok;
 }
 
-func (b *boolValue) String() string {
-       return fmt.Sprintf("%v", *b.p);
-}
+func (b *boolValue) String() string    { return fmt.Sprintf("%v", *b.p) }
 
 // -- Int Value
 type intValue struct {
@@ -95,9 +93,7 @@ func (i *intValue) set(s string) bool {
        return err == nil;
 }
 
-func (i *intValue) String() string {
-       return fmt.Sprintf("%v", *i.p);
-}
+func (i *intValue) String() string     { return fmt.Sprintf("%v", *i.p) }
 
 // -- Int64 Value
 type int64Value struct {
@@ -115,9 +111,7 @@ func (i *int64Value) set(s string) bool {
        return err == nil;
 }
 
-func (i *int64Value) String() string {
-       return fmt.Sprintf("%v", *i.p);
-}
+func (i *int64Value) String() string   { return fmt.Sprintf("%v", *i.p) }
 
 // -- Uint Value
 type uintValue struct {
@@ -135,9 +129,7 @@ func (i *uintValue) set(s string) bool {
        return err == nil;
 }
 
-func (i *uintValue) String() string {
-       return fmt.Sprintf("%v", *i.p);
-}
+func (i *uintValue) String() string    { return fmt.Sprintf("%v", *i.p) }
 
 // -- uint64 Value
 type uint64Value struct {
@@ -155,9 +147,7 @@ func (i *uint64Value) set(s string) bool {
        return err == nil;
 }
 
-func (i *uint64Value) String() string {
-       return fmt.Sprintf("%v", *i.p);
-}
+func (i *uint64Value) String() string  { return fmt.Sprintf("%v", *i.p) }
 
 // -- string Value
 type stringValue struct {
@@ -174,9 +164,7 @@ func (s *stringValue) set(val string) bool {
        return true;
 }
 
-func (s *stringValue) String() string {
-       return fmt.Sprintf("%s", *s.p);
-}
+func (s *stringValue) String() string  { return fmt.Sprintf("%s", *s.p) }
 
 // FlagValue is the interface to the dynamic value stored in a flag.
 // (The default value is represented as a string.)
@@ -258,9 +246,7 @@ var Usage = func() {
        PrintDefaults();
 }
 
-func NFlag() int {
-       return len(flags.actual);
-}
+func NFlag() int       { return len(flags.actual) }
 
 // Arg returns the i'th command-line argument.  Arg(0) is the first remaining argument
 // after flags have been processed.
@@ -273,14 +259,10 @@ func Arg(i int) string {
 }
 
 // NArg is the number of arguments remaining after flags have been processed.
-func NArg() int {
-       return len(os.Args) - flags.first_arg;
-}
+func NArg() int        { return len(os.Args) - flags.first_arg }
 
 // Args returns the non-flag command-line arguments.
-func Args() []string {
-       return os.Args[flags.first_arg : len(os.Args)];
-}
+func Args() []string   { return os.Args[flags.first_arg : len(os.Args)] }
 
 func add(name string, value FlagValue, usage string) {
        // Remember the default value as a string; it won't change.
index c929ea879db24f90829299450af425d6969ecdfb..bd09017719202c97017374d0bd8e4f419f2b0e53 100644 (file)
@@ -54,9 +54,7 @@ func (f *Fmt) clearflags() {
        f.zero = false;
 }
 
-func (f *Fmt) clearbuf() {
-       f.buf = "";
-}
+func (f *Fmt) clearbuf()       { f.buf = "" }
 
 func (f *Fmt) init() {
        f.clearbuf();
@@ -239,14 +237,10 @@ func (f *Fmt) Fmt_d64(v int64) *Fmt {
 }
 
 // Fmt_d32 formats an int32 in decimal.
-func (f *Fmt) Fmt_d32(v int32) *Fmt {
-       return f.Fmt_d64(int64(v));
-}
+func (f *Fmt) Fmt_d32(v int32) *Fmt    { return f.Fmt_d64(int64(v)) }
 
 // Fmt_d formats an int in decimal.
-func (f *Fmt) Fmt_d(v int) *Fmt {
-       return f.Fmt_d64(int64(v));
-}
+func (f *Fmt) Fmt_d(v int) *Fmt        { return f.Fmt_d64(int64(v)) }
 
 // Fmt_ud64 formats a uint64 in decimal.
 func (f *Fmt) Fmt_ud64(v uint64) *Fmt {
@@ -256,14 +250,10 @@ func (f *Fmt) Fmt_ud64(v uint64) *Fmt {
 }
 
 // Fmt_ud32 formats a uint32 in decimal.
-func (f *Fmt) Fmt_ud32(v uint32) *Fmt {
-       return f.Fmt_ud64(uint64(v));
-}
+func (f *Fmt) Fmt_ud32(v uint32) *Fmt  { return f.Fmt_ud64(uint64(v)) }
 
 // Fmt_ud formats a uint in decimal.
-func (f *Fmt) Fmt_ud(v uint) *Fmt {
-       return f.Fmt_ud64(uint64(v));
-}
+func (f *Fmt) Fmt_ud(v uint) *Fmt      { return f.Fmt_ud64(uint64(v)) }
 
 // Fmt_x64 formats an int64 in hexadecimal.
 func (f *Fmt) Fmt_x64(v int64) *Fmt {
@@ -273,14 +263,10 @@ func (f *Fmt) Fmt_x64(v int64) *Fmt {
 }
 
 // Fmt_x32 formats an int32 in hexadecimal.
-func (f *Fmt) Fmt_x32(v int32) *Fmt {
-       return f.Fmt_x64(int64(v));
-}
+func (f *Fmt) Fmt_x32(v int32) *Fmt    { return f.Fmt_x64(int64(v)) }
 
 // Fmt_x formats an int in hexadecimal.
-func (f *Fmt) Fmt_x(v int) *Fmt {
-       return f.Fmt_x64(int64(v));
-}
+func (f *Fmt) Fmt_x(v int) *Fmt        { return f.Fmt_x64(int64(v)) }
 
 // Fmt_ux64 formats a uint64 in hexadecimal.
 func (f *Fmt) Fmt_ux64(v uint64) *Fmt {
@@ -290,14 +276,10 @@ func (f *Fmt) Fmt_ux64(v uint64) *Fmt {
 }
 
 // Fmt_ux32 formats a uint32 in hexadecimal.
-func (f *Fmt) Fmt_ux32(v uint32) *Fmt {
-       return f.Fmt_ux64(uint64(v));
-}
+func (f *Fmt) Fmt_ux32(v uint32) *Fmt  { return f.Fmt_ux64(uint64(v)) }
 
 // Fmt_ux formats a uint in hexadecimal.
-func (f *Fmt) Fmt_ux(v uint) *Fmt {
-       return f.Fmt_ux64(uint64(v));
-}
+func (f *Fmt) Fmt_ux(v uint) *Fmt      { return f.Fmt_ux64(uint64(v)) }
 
 // Fmt_X64 formats an int64 in upper case hexadecimal.
 func (f *Fmt) Fmt_X64(v int64) *Fmt {
@@ -307,14 +289,10 @@ func (f *Fmt) Fmt_X64(v int64) *Fmt {
 }
 
 // Fmt_X32 formats an int32 in upper case hexadecimal.
-func (f *Fmt) Fmt_X32(v int32) *Fmt {
-       return f.Fmt_X64(int64(v));
-}
+func (f *Fmt) Fmt_X32(v int32) *Fmt    { return f.Fmt_X64(int64(v)) }
 
 // Fmt_X formats an int in upper case hexadecimal.
-func (f *Fmt) Fmt_X(v int) *Fmt {
-       return f.Fmt_X64(int64(v));
-}
+func (f *Fmt) Fmt_X(v int) *Fmt        { return f.Fmt_X64(int64(v)) }
 
 // Fmt_uX64 formats a uint64 in upper case hexadecimal.
 func (f *Fmt) Fmt_uX64(v uint64) *Fmt {
@@ -324,14 +302,10 @@ func (f *Fmt) Fmt_uX64(v uint64) *Fmt {
 }
 
 // Fmt_uX32 formats a uint32 in upper case hexadecimal.
-func (f *Fmt) Fmt_uX32(v uint32) *Fmt {
-       return f.Fmt_uX64(uint64(v));
-}
+func (f *Fmt) Fmt_uX32(v uint32) *Fmt  { return f.Fmt_uX64(uint64(v)) }
 
 // Fmt_uX formats a uint in upper case hexadecimal.
-func (f *Fmt) Fmt_uX(v uint) *Fmt {
-       return f.Fmt_uX64(uint64(v));
-}
+func (f *Fmt) Fmt_uX(v uint) *Fmt      { return f.Fmt_uX64(uint64(v)) }
 
 // Fmt_o64 formats an int64 in octal.
 func (f *Fmt) Fmt_o64(v int64) *Fmt {
@@ -341,14 +315,10 @@ func (f *Fmt) Fmt_o64(v int64) *Fmt {
 }
 
 // Fmt_o32 formats an int32 in octal.
-func (f *Fmt) Fmt_o32(v int32) *Fmt {
-       return f.Fmt_o64(int64(v));
-}
+func (f *Fmt) Fmt_o32(v int32) *Fmt    { return f.Fmt_o64(int64(v)) }
 
 // Fmt_o formats an int in octal.
-func (f *Fmt) Fmt_o(v int) *Fmt {
-       return f.Fmt_o64(int64(v));
-}
+func (f *Fmt) Fmt_o(v int) *Fmt        { return f.Fmt_o64(int64(v)) }
 
 // Fmt_uo64 formats a uint64 in octal.
 func (f *Fmt) Fmt_uo64(v uint64) *Fmt {
@@ -358,14 +328,10 @@ func (f *Fmt) Fmt_uo64(v uint64) *Fmt {
 }
 
 // Fmt_uo32 formats a uint32 in octal.
-func (f *Fmt) Fmt_uo32(v uint32) *Fmt {
-       return f.Fmt_uo64(uint64(v));
-}
+func (f *Fmt) Fmt_uo32(v uint32) *Fmt  { return f.Fmt_uo64(uint64(v)) }
 
 // Fmt_uo formats a uint in octal.
-func (f *Fmt) Fmt_uo(v uint) *Fmt {
-       return f.Fmt_uo64(uint64(v));
-}
+func (f *Fmt) Fmt_uo(v uint) *Fmt      { return f.Fmt_uo64(uint64(v)) }
 
 // Fmt_b64 formats a uint64 in binary.
 func (f *Fmt) Fmt_b64(v uint64) *Fmt {
@@ -375,14 +341,10 @@ func (f *Fmt) Fmt_b64(v uint64) *Fmt {
 }
 
 // Fmt_b32 formats a uint32 in binary.
-func (f *Fmt) Fmt_b32(v uint32) *Fmt {
-       return f.Fmt_b64(uint64(v));
-}
+func (f *Fmt) Fmt_b32(v uint32) *Fmt   { return f.Fmt_b64(uint64(v)) }
 
 // Fmt_b formats a uint in binary.
-func (f *Fmt) Fmt_b(v uint) *Fmt {
-       return f.Fmt_b64(uint64(v));
-}
+func (f *Fmt) Fmt_b(v uint) *Fmt       { return f.Fmt_b64(uint64(v)) }
 
 // Fmt_c formats a Unicode character.
 func (f *Fmt) Fmt_c(v int) *Fmt {
@@ -486,9 +448,7 @@ func (f *Fmt) Fmt_G64(v float64) *Fmt {
 }
 
 // Fmt_fb64 formats a float64 in the form -123p3 (exponent is power of 2).
-func (f *Fmt) Fmt_fb64(v float64) *Fmt {
-       return fmtString(f, strconv.Ftoa64(v, 'b', 0));
-}
+func (f *Fmt) Fmt_fb64(v float64) *Fmt { return fmtString(f, strconv.Ftoa64(v, 'b', 0)) }
 
 // float32
 // cannot defer to float64 versions
@@ -520,9 +480,7 @@ func (f *Fmt) Fmt_G32(v float32) *Fmt {
 }
 
 // Fmt_fb32 formats a float32 in the form -123p3 (exponent is power of 2).
-func (f *Fmt) Fmt_fb32(v float32) *Fmt {
-       return fmtString(f, strconv.Ftoa32(v, 'b', 0));
-}
+func (f *Fmt) Fmt_fb32(v float32) *Fmt { return fmtString(f, strconv.Ftoa32(v, 'b', 0)) }
 
 // float
 func (x *Fmt) f(a float) *Fmt {
index 58163124c4828778fd9c30a020eda291d63a2627..a27c65cf79410d246d81b5b2ccbda9a713e8418e 100644 (file)
@@ -136,13 +136,9 @@ func newPrinter() *pp {
        return p;
 }
 
-func (p *pp) Width() (wid int, ok bool) {
-       return p.fmt.wid, p.fmt.wid_present;
-}
+func (p *pp) Width() (wid int, ok bool)        { return p.fmt.wid, p.fmt.wid_present }
 
-func (p *pp) Precision() (prec int, ok bool) {
-       return p.fmt.prec, p.fmt.prec_present;
-}
+func (p *pp) Precision() (prec int, ok bool)   { return p.fmt.prec, p.fmt.prec_present }
 
 func (p *pp) Flag(b int) bool {
        switch b {
index 92f24d6ef80e62a4eb6b4dc7737b9b6b116b396e..ec299c5f7522adaf13b3189ae199ff3f2992426f 100644 (file)
@@ -300,82 +300,42 @@ type (
 // Pos() implementations for expression/type where the position
 // corresponds to the position of a sub-node.
 //
-func (x *StringList) Pos() token.Position {
-       return x.Strings[0].Pos();
-}
-func (x *FuncLit) Pos() token.Position {
-       return x.Type.Pos();
-}
-func (x *CompositeLit) Pos() token.Position {
-       return x.Type.Pos();
-}
-func (x *SelectorExpr) Pos() token.Position {
-       return x.X.Pos();
-}
-func (x *IndexExpr) Pos() token.Position {
-       return x.X.Pos();
-}
-func (x *TypeAssertExpr) Pos() token.Position {
-       return x.X.Pos();
-}
-func (x *CallExpr) Pos() token.Position {
-       return x.Fun.Pos();
-}
-func (x *BinaryExpr) Pos() token.Position {
-       return x.X.Pos();
-}
-func (x *KeyValueExpr) Pos() token.Position {
-       return x.Key.Pos();
-}
+func (x *StringList) Pos() token.Position      { return x.Strings[0].Pos() }
+func (x *FuncLit) Pos() token.Position         { return x.Type.Pos() }
+func (x *CompositeLit) Pos() token.Position    { return x.Type.Pos() }
+func (x *SelectorExpr) Pos() token.Position    { return x.X.Pos() }
+func (x *IndexExpr) Pos() token.Position       { return x.X.Pos() }
+func (x *TypeAssertExpr) Pos() token.Position  { return x.X.Pos() }
+func (x *CallExpr) Pos() token.Position                { return x.Fun.Pos() }
+func (x *BinaryExpr) Pos() token.Position      { return x.X.Pos() }
+func (x *KeyValueExpr) Pos() token.Position    { return x.Key.Pos() }
 
 
 // exprNode() ensures that only expression/type nodes can be
 // assigned to an ExprNode.
-func (x *BadExpr) exprNode() {
-}
-func (x *Ident) exprNode() {
-}
-func (x *Ellipsis) exprNode() {
-}
-func (x *BasicLit) exprNode() {
-}
-func (x *StringList) exprNode() {
-}
-func (x *FuncLit) exprNode() {
-}
-func (x *CompositeLit) exprNode() {
-}
-func (x *ParenExpr) exprNode() {
-}
-func (x *SelectorExpr) exprNode() {
-}
-func (x *IndexExpr) exprNode() {
-}
-func (x *TypeAssertExpr) exprNode() {
-}
-func (x *CallExpr) exprNode() {
-}
-func (x *StarExpr) exprNode() {
-}
-func (x *UnaryExpr) exprNode() {
-}
-func (x *BinaryExpr) exprNode() {
-}
-func (x *KeyValueExpr) exprNode() {
-}
-
-func (x *ArrayType) exprNode() {
-}
-func (x *StructType) exprNode() {
-}
-func (x *FuncType) exprNode() {
-}
-func (x *InterfaceType) exprNode() {
-}
-func (x *MapType) exprNode() {
-}
-func (x *ChanType) exprNode() {
-}
+func (x *BadExpr) exprNode()           {}
+func (x *Ident) exprNode()             {}
+func (x *Ellipsis) exprNode()          {}
+func (x *BasicLit) exprNode()          {}
+func (x *StringList) exprNode()                {}
+func (x *FuncLit) exprNode()           {}
+func (x *CompositeLit) exprNode()      {}
+func (x *ParenExpr) exprNode()         {}
+func (x *SelectorExpr) exprNode()      {}
+func (x *IndexExpr) exprNode()         {}
+func (x *TypeAssertExpr) exprNode()    {}
+func (x *CallExpr) exprNode()          {}
+func (x *StarExpr) exprNode()          {}
+func (x *UnaryExpr) exprNode()         {}
+func (x *BinaryExpr) exprNode()                {}
+func (x *KeyValueExpr) exprNode()      {}
+
+func (x *ArrayType) exprNode()         {}
+func (x *StructType) exprNode()                {}
+func (x *FuncType) exprNode()          {}
+func (x *InterfaceType) exprNode()     {}
+func (x *MapType) exprNode()           {}
+func (x *ChanType) exprNode()          {}
 
 
 // IsExported returns whether name is an exported Go symbol
@@ -387,13 +347,9 @@ func IsExported(name string) bool {
 
 // IsExported returns whether name is an exported Go symbol
 // (i.e., whether it begins with an uppercase letter).
-func (name *Ident) IsExported() bool {
-       return IsExported(name.Value);
-}
+func (name *Ident) IsExported() bool   { return IsExported(name.Value) }
 
-func (name *Ident) String() string {
-       return name.Value;
-}
+func (name *Ident) String() string     { return name.Value }
 
 
 // ----------------------------------------------------------------------------
@@ -566,68 +522,37 @@ type (
 // Pos() implementations for statement nodes where the position
 // corresponds to the position of a sub-node.
 //
-func (s *DeclStmt) Pos() token.Position {
-       return s.Decl.Pos();
-}
-func (s *LabeledStmt) Pos() token.Position {
-       return s.Label.Pos();
-}
-func (s *ExprStmt) Pos() token.Position {
-       return s.X.Pos();
-}
-func (s *IncDecStmt) Pos() token.Position {
-       return s.X.Pos();
-}
-func (s *AssignStmt) Pos() token.Position {
-       return s.Lhs[0].Pos();
-}
+func (s *DeclStmt) Pos() token.Position                { return s.Decl.Pos() }
+func (s *LabeledStmt) Pos() token.Position     { return s.Label.Pos() }
+func (s *ExprStmt) Pos() token.Position                { return s.X.Pos() }
+func (s *IncDecStmt) Pos() token.Position      { return s.X.Pos() }
+func (s *AssignStmt) Pos() token.Position      { return s.Lhs[0].Pos() }
 
 
 // stmtNode() ensures that only statement nodes can be
 // assigned to a StmtNode.
 //
-func (s *BadStmt) stmtNode() {
-}
-func (s *DeclStmt) stmtNode() {
-}
-func (s *EmptyStmt) stmtNode() {
-}
-func (s *LabeledStmt) stmtNode() {
-}
-func (s *ExprStmt) stmtNode() {
-}
-func (s *IncDecStmt) stmtNode() {
-}
-func (s *AssignStmt) stmtNode() {
-}
-func (s *GoStmt) stmtNode() {
-}
-func (s *DeferStmt) stmtNode() {
-}
-func (s *ReturnStmt) stmtNode() {
-}
-func (s *BranchStmt) stmtNode() {
-}
-func (s *BlockStmt) stmtNode() {
-}
-func (s *IfStmt) stmtNode() {
-}
-func (s *CaseClause) stmtNode() {
-}
-func (s *SwitchStmt) stmtNode() {
-}
-func (s *TypeCaseClause) stmtNode() {
-}
-func (s *TypeSwitchStmt) stmtNode() {
-}
-func (s *CommClause) stmtNode() {
-}
-func (s *SelectStmt) stmtNode() {
-}
-func (s *ForStmt) stmtNode() {
-}
-func (s *RangeStmt) stmtNode() {
-}
+func (s *BadStmt) stmtNode()           {}
+func (s *DeclStmt) stmtNode()          {}
+func (s *EmptyStmt) stmtNode()         {}
+func (s *LabeledStmt) stmtNode()       {}
+func (s *ExprStmt) stmtNode()          {}
+func (s *IncDecStmt) stmtNode()                {}
+func (s *AssignStmt) stmtNode()                {}
+func (s *GoStmt) stmtNode()            {}
+func (s *DeferStmt) stmtNode()         {}
+func (s *ReturnStmt) stmtNode()                {}
+func (s *BranchStmt) stmtNode()                {}
+func (s *BlockStmt) stmtNode()         {}
+func (s *IfStmt) stmtNode()            {}
+func (s *CaseClause) stmtNode()                {}
+func (s *SwitchStmt) stmtNode()                {}
+func (s *TypeCaseClause) stmtNode()    {}
+func (s *TypeSwitchStmt) stmtNode()    {}
+func (s *CommClause) stmtNode()                {}
+func (s *SelectStmt) stmtNode()                {}
+func (s *ForStmt) stmtNode()           {}
+func (s *RangeStmt) stmtNode()         {}
 
 
 // ----------------------------------------------------------------------------
@@ -680,23 +605,16 @@ func (s *ImportSpec) Pos() token.Position {
        return s.Path[0].Pos();
 }
 
-func (s *ValueSpec) Pos() token.Position {
-       return s.Names[0].Pos();
-}
-func (s *TypeSpec) Pos() token.Position {
-       return s.Name.Pos();
-}
+func (s *ValueSpec) Pos() token.Position       { return s.Names[0].Pos() }
+func (s *TypeSpec) Pos() token.Position                { return s.Name.Pos() }
 
 
 // specNode() ensures that only spec nodes can be
 // assigned to a Spec.
 //
-func (s *ImportSpec) specNode() {
-}
-func (s *ValueSpec) specNode() {
-}
-func (s *TypeSpec) specNode() {
-}
+func (s *ImportSpec) specNode()        {}
+func (s *ValueSpec) specNode() {}
+func (s *TypeSpec) specNode()  {}
 
 
 // A declaration is represented by one of the following declaration nodes.
@@ -742,20 +660,15 @@ type (
 
 
 // The position of a FuncDecl node is the position of its function type.
-func (d *FuncDecl) Pos() token.Position {
-       return d.Type.Pos();
-}
+func (d *FuncDecl) Pos() token.Position        { return d.Type.Pos() }
 
 
 // declNode() ensures that only declaration nodes can be
 // assigned to a DeclNode.
 //
-func (d *BadDecl) declNode() {
-}
-func (d *GenDecl) declNode() {
-}
-func (d *FuncDecl) declNode() {
-}
+func (d *BadDecl) declNode()   {}
+func (d *GenDecl) declNode()   {}
+func (d *FuncDecl) declNode()  {}
 
 
 // ----------------------------------------------------------------------------
index 988b11e957c04b20ff870b8a8a0f67275680e955..301630de6482fc8c21a3e676413249dcdc5efeb8 100644 (file)
@@ -17,9 +17,7 @@ type Scope struct {
 
 
 // NewScope creates a new scope nested in the outer scope.
-func NewScope(outer *Scope) *Scope {
-       return &Scope{outer, make(map[string]*Ident)};
-}
+func NewScope(outer *Scope) *Scope     { return &Scope{outer, make(map[string]*Ident)} }
 
 
 // Declare inserts an identifier into the scope s. If the
index 18fce5c4ea21c6f49d82969a41960656d9cdd94f..75eb7064bff986850795b8705adc64dfb40a4288 100644 (file)
@@ -165,9 +165,7 @@ func indentLen(s []byte) int {
 }
 
 
-func isBlank(s []byte) bool {
-       return len(s) == 0 || (len(s) == 1 && s[0] == '\n');
-}
+func isBlank(s []byte) bool    { return len(s) == 0 || (len(s) == 1 && s[0] == '\n') }
 
 
 func commonPrefix(a, b []byte) []byte {
index 7f8c558e798ed062b64967f9e745268f721c9a0f..d9d436ccbb5a0899aa524a38aaf629e84ff9fddb 100644 (file)
@@ -324,12 +324,8 @@ type ValueDoc struct {
 
 type sortValueDoc []*ValueDoc
 
-func (p sortValueDoc) Len() int {
-       return len(p);
-}
-func (p sortValueDoc) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
+func (p sortValueDoc) Len() int                { return len(p) }
+func (p sortValueDoc) Swap(i, j int)   { p[i], p[j] = p[j], p[i] }
 
 
 func declName(d *ast.GenDecl) string {
@@ -388,15 +384,9 @@ type FuncDoc struct {
 
 type sortFuncDoc []*FuncDoc
 
-func (p sortFuncDoc) Len() int {
-       return len(p);
-}
-func (p sortFuncDoc) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
-func (p sortFuncDoc) Less(i, j int) bool {
-       return p[i].Name < p[j].Name;
-}
+func (p sortFuncDoc) Len() int                 { return len(p) }
+func (p sortFuncDoc) Swap(i, j int)            { p[i], p[j] = p[j], p[i] }
+func (p sortFuncDoc) Less(i, j int) bool       { return p[i].Name < p[j].Name }
 
 
 func makeFuncDocs(m map[string]*ast.FuncDecl) []*FuncDoc {
@@ -436,12 +426,8 @@ type TypeDoc struct {
 
 type sortTypeDoc []*TypeDoc
 
-func (p sortTypeDoc) Len() int {
-       return len(p);
-}
-func (p sortTypeDoc) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
+func (p sortTypeDoc) Len() int         { return len(p) }
+func (p sortTypeDoc) Swap(i, j int)    { p[i], p[j] = p[j], p[i] }
 func (p sortTypeDoc) Less(i, j int) bool {
        // sort by name
        // pull blocks (name = "") up to top
index 9fd8de8f454ab22ea32e33009f3270f227440704..53fff192dc57aed58b383bf54331543cd1c8b519 100644 (file)
@@ -273,9 +273,7 @@ func openScope(p *parser) *parser {
 
 
 // Usage pattern: defer close(openScope(p));
-func close(p *parser) {
-       p.topScope = p.topScope.Outer;
-}
+func close(p *parser)  { p.topScope = p.topScope.Outer }
 
 
 func (p *parser) declare(ident *ast.Ident) {
@@ -787,9 +785,7 @@ func (p *parser) tryRawType(ellipsisOk bool) ast.Expr {
 }
 
 
-func (p *parser) tryType() ast.Expr {
-       return p.tryRawType(false);
-}
+func (p *parser) tryType() ast.Expr    { return p.tryRawType(false) }
 
 
 // ----------------------------------------------------------------------------
index fc366bcc39ddd4b83893a187b87d3ac4d1f71ede..257ef9a7fe0bb0c8c2015843e19764c122c900af 100644 (file)
@@ -72,9 +72,7 @@ func nameFilter(filename string) bool {
 }
 
 
-func dirFilter(d *os.Dir) bool {
-       return nameFilter(d.Name);
-}
+func dirFilter(d *os.Dir) bool { return nameFilter(d.Name) }
 
 
 func TestParse4(t *testing.T) {
index 7e27b3b6e7bae8885a2751d3623f50c1d469b04c..4c2f0c57f45a136bfd60f89551a76abc7b5e6261 100644 (file)
@@ -18,19 +18,21 @@ import (
 
 // Disabled formatting - enable eventually and remove the flag.
 const (
-       oneLineFuncDecls        = false;
        compositeLitBlank       = false;
        stringListMode          = exprListMode(0);      // previously: noIndent
 )
 
 
-// Other outstanding formatting issues:
+// Other formatting issues:
 // - replacement of expression spacing algorithm with rsc's algorithm
 // - support for one-line composite types (e.g. structs) as composite literals types
 // - better comment formatting for /*-style comments at the end of a line (e.g. a declaration)
-//   when the comment spans multiple lines
+//   when the comment spans multiple lines; if such a comment is just two lines, formatting is
+//   not idempotent
 // - formatting of expression lists; especially for string lists (stringListMode)
 // - blank after { and before } in one-line composite literals probably looks better
+// - should use blank instead of tab to separate one-line function bodies from
+//   the function header unless there is a group of consecutive one-liners
 
 
 // ----------------------------------------------------------------------------
@@ -497,7 +499,7 @@ func (p *printer) expr1(expr ast.Expr, prec1 int, multiLine *bool) (optSemi bool
 
        case *ast.FuncLit:
                p.expr(x.Type, multiLine);
-               p.funcBody(x.Body, true, multiLine);
+               p.funcBody(x.Body, distance(x.Type.Pos(), p.pos), true, multiLine);
 
        case *ast.ParenExpr:
                p.print(token.LPAREN);
@@ -994,42 +996,50 @@ func (p *printer) genDecl(d *ast.GenDecl, context declContext, multiLine *bool)
 }
 
 
-func (p *printer) isOneLiner(b *ast.BlockStmt) bool {
-       switch {
-       case len(b.List) > 1 || p.commentBefore(b.Rbrace):
-               return false;   // too many statements or there is a comment - all bets are off
-       case len(b.List) == 0:
-               return true;    // empty block and no comments
-       }
-
-       // test-print the statement and see if it would fit
+// nodeSize determines the size of n in chars after formatting.
+// The result is <= maxSize if the node fits on one line with at
+// most maxSize chars and the formatted output doesn't contain
+// any control chars. Otherwise, the result is > maxSize.
+//
+func (p *printer) nodeSize(n ast.Node, maxSize int) (size int) {
+       size = maxSize+1;       // assume n doesn't fit
        var buf bytes.Buffer;
-       _, err := p.Config.Fprint(&buf, b.List[0]);
-       if err != nil {
-               return false;   // don't try
-       }
-
-       if buf.Len() > 40 {
-               return false;   // too long
+       if _, err := p.Config.Fprint(&buf, n); err != nil {
+               return;
        }
-
-       for _, ch := range buf.Bytes() {
-               if ch < ' ' {
-                       return false;   // contains control chars (tabs, newlines)
+       if buf.Len() <= maxSize {
+               for _, ch := range buf.Bytes() {
+                       if ch < ' ' {
+                               return;
+                       }
                }
+               size = buf.Len();       // n fits
        }
+       return;
+}
 
-       return true;
+
+func (p *printer) isOneLineFunc(b *ast.BlockStmt, headerSize int) bool {
+       const maxSize = 90;     // adjust as appropriate, this is an approximate value
+       bodySize := 0;
+       switch {
+       case len(b.List) > 1 || p.commentBefore(b.Rbrace):
+               return false;   // too many statements or there is a comment - all bets are off
+       case len(b.List) == 1:
+               bodySize = p.nodeSize(b.List[0], maxSize);
+       }
+       // require both headers and overall size to be not "too large"
+       return headerSize <= maxSize/2 && headerSize + bodySize <= maxSize;
 }
 
 
 // Sets multiLine to true if the function body spans multiple lines.
-func (p *printer) funcBody(b *ast.BlockStmt, isLit bool, multiLine *bool) {
+func (p *printer) funcBody(b *ast.BlockStmt, headerSize int, isLit bool, multiLine *bool) {
        if b == nil {
                return;
        }
 
-       if (oneLineFuncDecls || isLit) && p.isOneLiner(b) {
+       if p.isOneLineFunc(b, headerSize) {
                sep := vtab;
                if isLit {
                        sep = blank;
@@ -1050,6 +1060,17 @@ func (p *printer) funcBody(b *ast.BlockStmt, isLit bool, multiLine *bool) {
 }
 
 
+// distance returns the column difference between from and to if both
+// are on the same line; if they are on different lines (or unknown)
+// the result is infinity (1<<30).
+func distance(from, to token.Position) int {
+       if from.IsValid() && to.IsValid() && from.Line == to.Line {
+               return to.Column - from.Column;
+       }
+       return 1<<30;
+}
+
+
 // Sets multiLine to true if the declaration spans multiple lines.
 func (p *printer) funcDecl(d *ast.FuncDecl, multiLine *bool) {
        p.leadComment(d.Doc);
@@ -1066,7 +1087,7 @@ func (p *printer) funcDecl(d *ast.FuncDecl, multiLine *bool) {
        }
        p.expr(d.Name, multiLine);
        p.signature(d.Type.Params, d.Type.Results, multiLine);
-       p.funcBody(d.Body, false, multiLine);
+       p.funcBody(d.Body, distance(d.Pos(), p.pos), false, multiLine);
 }
 
 
index 94a4d8da678d292a8a7d1d2ed23d58ea41fc34a5..cb28274765904b4b64e041c4f59392aeb75cd65f 100644 (file)
@@ -278,8 +278,7 @@ func _() {
 
 
 // Some interesting interspersed comments
-func _( /* this */ x /* is */ /* an */ int) {
-}
+func _( /* this */ x /* is */ /* an */ int)    {}
 
 
 // Line comments with tabs
index 2f5cf6059facc36261b742f679a8098f13f1292c..43ba1fd532b203e96ead2f2361010d70a559ca28 100644 (file)
@@ -445,26 +445,14 @@ func _() {
 
 
 // formatting of consecutive single-line functions
-func _() {
-}
-func _() {
-}
-func _() {
-}
+func _()       {}
+func _()       {}
+func _()       {}
 
-func _() {
-}      // an empty line before this function
-func _() {
-}
-func _() {
-}
+func _()       {}      // an empty line before this function
+func _()       {}
+func _()       {}
 
-func _() {
-       f(1, 2, 3);
-}
-func _(x int) int {
-       return x+1;
-}
-func _() int {
-       type T struct{}
-}
+func _()               { f(1, 2, 3) }
+func _(x int) int      { return x+1 }
+func _() int           { type T struct{} }
index a1839aa186412f911f34c2bf690b36d34aaf044f..875bac40b3838f6209627c065b72de271a1fac43 100644 (file)
@@ -6,8 +6,7 @@ package statements
 
 var expr bool
 
-func use(x interface{}) {
-}
+func use(x interface{})        {}
 
 // Formatting of if-statement headers.
 func _() {
index 0900667013a1b66adf7854411f0f4809c5412a00..a8219b19033aea741a3a3ff8b84f75a203c447fc 100644 (file)
@@ -39,9 +39,7 @@ type ErrorVector struct {
 
 
 // Init initializes an ErrorVector.
-func (h *ErrorVector) Init() {
-       h.errors.Init(0);
-}
+func (h *ErrorVector) Init()   { h.errors.Init(0) }
 
 
 // NewErrorVector creates a new ErrorVector.
@@ -53,9 +51,7 @@ func NewErrorVector() *ErrorVector {
 
 
 // ErrorCount returns the number of errors collected.
-func (h *ErrorVector) ErrorCount() int {
-       return h.errors.Len();
-}
+func (h *ErrorVector) ErrorCount() int { return h.errors.Len() }
 
 
 // Within ErrorVector, an error is represented by an Error node. The
@@ -83,12 +79,8 @@ type ErrorList []*Error
 
 
 // ErrorList implements the sort Interface.
-func (p ErrorList) Len() int {
-       return len(p);
-}
-func (p ErrorList) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
+func (p ErrorList) Len() int           { return len(p) }
+func (p ErrorList) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
 
 
 func (p ErrorList) Less(i, j int) bool {
index 052f3a8a8b3c30d0186258aca89c21777129af2b..0b036e8b462bfe262a8fd81434c9855917b2541e 100644 (file)
@@ -357,7 +357,9 @@ func TestStdErrorHander(t *testing.T) {
 
        v := NewErrorVector();
        nerrors := Tokenize("File1", strings.Bytes(src), v, 0,
-               func(pos token.Position, tok token.Token, litb []byte) bool { return tok != token.EOF });
+               func(pos token.Position, tok token.Token, litb []byte) bool {
+                       return tok != token.EOF;
+               });
 
        list := v.GetErrorList(Raw);
        if len(list) != 9 {
index b3191c22c7ec5f35c2b3ab9b67dbab7ac1a61702..28c335461841537db4aa006ee5bf5758c58ed7a5 100644 (file)
@@ -308,23 +308,17 @@ func Lookup(ident []byte) Token {
 // IsLiteral returns true for tokens corresponding to identifiers
 // and basic type literals; returns false otherwise.
 //
-func (tok Token) IsLiteral() bool {
-       return literal_beg < tok && tok < literal_end;
-}
+func (tok Token) IsLiteral() bool      { return literal_beg < tok && tok < literal_end }
 
 // IsOperator returns true for tokens corresponding to operators and
 // delimiters; returns false otherwise.
 //
-func (tok Token) IsOperator() bool {
-       return operator_beg < tok && tok < operator_end;
-}
+func (tok Token) IsOperator() bool     { return operator_beg < tok && tok < operator_end }
 
 // IsKeyword returns true for tokens corresponding to keywords;
 // returns false otherwise.
 //
-func (tok Token) IsKeyword() bool {
-       return keyword_beg < tok && tok < keyword_end;
-}
+func (tok Token) IsKeyword() bool      { return keyword_beg < tok && tok < keyword_end }
 
 
 // Token source positions are represented by a Position value.
@@ -341,15 +335,11 @@ type Position struct {
 // Pos is an accessor method for anonymous Position fields.
 // It returns its receiver.
 //
-func (pos *Position) Pos() Position {
-       return *pos;
-}
+func (pos *Position) Pos() Position    { return *pos }
 
 
 // IsValid returns true if the position is valid.
-func (pos *Position) IsValid() bool {
-       return pos.Line > 0;
-}
+func (pos *Position) IsValid() bool    { return pos.Line > 0 }
 
 
 func (pos Position) String() string {
index 48221f117fec70d03ad605e66a32e54f520b135e..e9e093eef543f22b9ca98146a3bfff6d5db17d60 100644 (file)
@@ -579,7 +579,9 @@ func decIgnoreOpFor(wireId typeId) (decOp, os.Error) {
                        if err != nil {
                                return nil, err;
                        }
-                       op = func(i *decInstr, state *decodeState, p unsafe.Pointer) { state.err = ignoreSlice(state, elemOp) };
+                       op = func(i *decInstr, state *decodeState, p unsafe.Pointer) {
+                               state.err = ignoreSlice(state, elemOp);
+                       };
 
                case *arrayType:
                        elemId := wireId.gobType().(*arrayType).Elem;
index c8110216e7b76d9e42bd155d64e3db1cb39d7abb..ec8a347e4b62482fc54569462b0d66272f034bad 100644 (file)
@@ -25,15 +25,11 @@ type kind reflect.Type
 //     int8, int16, int, uint, float, func, chan, struct, and so on.
 // That is, all struct types have the same kind, all func types have the same
 // kind, all int8 types have the same kind, and so on.
-func typeKind(typ reflect.Type) kind {
-       return kind(reflect.Typeof(typ));
-}
+func typeKind(typ reflect.Type) kind   { return kind(reflect.Typeof(typ)) }
 
 // valueKind returns the kind of the value type
 // stored inside the interface v.
-func valueKind(v interface{}) reflect.Type {
-       return typeKind(reflect.Typeof(v));
-}
+func valueKind(v interface{}) reflect.Type     { return typeKind(reflect.Typeof(v)) }
 
 // A typeId represents a gob Type as an integer that can be passed on the wire.
 // Internally, typeIds are used as keys to a map to recover the underlying type info.
@@ -67,14 +63,10 @@ func (t typeId) gobType() gobType {
 }
 
 // String returns the string representation of the type associated with the typeId.
-func (t typeId) String() string {
-       return t.gobType().String();
-}
+func (t typeId) String() string        { return t.gobType().String() }
 
 // Name returns the name of the type associated with the typeId.
-func (t typeId) Name() string {
-       return t.gobType().Name();
-}
+func (t typeId) Name() string  { return t.gobType().Name() }
 
 // Common elements of all types.
 type commonType struct {
@@ -82,25 +74,17 @@ type commonType struct {
        _id     typeId;
 }
 
-func (t *commonType) id() typeId {
-       return t._id;
-}
+func (t *commonType) id() typeId       { return t._id }
 
-func (t *commonType) setId(id typeId) {
-       t._id = id;
-}
+func (t *commonType) setId(id typeId)  { t._id = id }
 
-func (t *commonType) String() string {
-       return t.name;
-}
+func (t *commonType) String() string   { return t.name }
 
 func (t *commonType) safeString(seen map[typeId]bool) string {
        return t.name;
 }
 
-func (t *commonType) Name() string {
-       return t.name;
-}
+func (t *commonType) Name() string     { return t.name }
 
 // Create and check predefined types
 // The string for tBytes is "bytes" not "[]byte" to signify its specialness.
@@ -143,9 +127,7 @@ func (a *arrayType) safeString(seen map[typeId]bool) string {
        return fmt.Sprintf("[%d]%s", a.Len, a.Elem.gobType().safeString(seen));
 }
 
-func (a *arrayType) String() string {
-       return a.safeString(make(map[typeId]bool));
-}
+func (a *arrayType) String() string    { return a.safeString(make(map[typeId]bool)) }
 
 // Slice type
 type sliceType struct {
@@ -167,9 +149,7 @@ func (s *sliceType) safeString(seen map[typeId]bool) string {
        return fmt.Sprintf("[]%s", s.Elem.gobType().safeString(seen));
 }
 
-func (s *sliceType) String() string {
-       return s.safeString(make(map[typeId]bool));
-}
+func (s *sliceType) String() string    { return s.safeString(make(map[typeId]bool)) }
 
 // Struct type
 type fieldType struct {
@@ -198,9 +178,7 @@ func (s *structType) safeString(seen map[typeId]bool) string {
        return str;
 }
 
-func (s *structType) String() string {
-       return s.safeString(make(map[typeId]bool));
-}
+func (s *structType) String() string   { return s.safeString(make(map[typeId]bool)) }
 
 func newStructType(name string) *structType {
        s := &structType{commonType{name: name}, nil};
index 2cd7a198aea4f1878d702666ffa728892baea594..3ac6364f9fad053bd355663475b5eb2b2dad85c3 100644 (file)
@@ -30,9 +30,7 @@ type digest struct {
        a, b uint32;
 }
 
-func (d *digest) Reset() {
-       d.a, d.b = 1, 0;
-}
+func (d *digest) Reset()       { d.a, d.b = 1, 0 }
 
 // New returns a new Hash32 computing the Adler-32 checksum.
 func New() hash.Hash32 {
@@ -41,9 +39,7 @@ func New() hash.Hash32 {
        return d;
 }
 
-func (d *digest) Size() int {
-       return Size;
-}
+func (d *digest) Size() int    { return Size }
 
 // Add p to the running checksum a, b.
 func update(a, b uint32, p []byte) (aa, bb uint32) {
@@ -76,9 +72,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) {
        return len(p), nil;
 }
 
-func (d *digest) Sum32() uint32 {
-       return finish(d.a, d.b);
-}
+func (d *digest) Sum32() uint32        { return finish(d.a, d.b) }
 
 func (d *digest) Sum() []byte {
        p := make([]byte, 4);
@@ -91,6 +85,4 @@ func (d *digest) Sum() []byte {
 }
 
 // Checksum returns the Adler-32 checksum of data.
-func Checksum(data []byte) uint32 {
-       return finish(update(1, 0, data));
-}
+func Checksum(data []byte) uint32      { return finish(update(1, 0, data)) }
index 2f5fb8f8944157a874c320adf971973ede7f0226..e450f5fb742f79c37f76e97c28d987260adbe7fc 100644 (file)
@@ -62,23 +62,15 @@ type digest struct {
 
 // New creates a new Hash computing the CRC-32 checksum
 // using the polynomial represented by the Table.
-func New(tab *Table) hash.Hash32 {
-       return &digest{0, tab};
-}
+func New(tab *Table) hash.Hash32       { return &digest{0, tab} }
 
 // NewIEEE creates a new Hash computing the CRC-32 checksum
 // using the IEEE polynomial.
-func NewIEEE() hash.Hash32 {
-       return New(IEEETable);
-}
+func NewIEEE() hash.Hash32     { return New(IEEETable) }
 
-func (d *digest) Size() int {
-       return Size;
-}
+func (d *digest) Size() int    { return Size }
 
-func (d *digest) Reset() {
-       d.crc = 0;
-}
+func (d *digest) Reset()       { d.crc = 0 }
 
 func update(crc uint32, tab *Table, p []byte) uint32 {
        crc = ^crc;
@@ -93,9 +85,7 @@ func (d *digest) Write(p []byte) (n int, err os.Error) {
        return len(p), nil;
 }
 
-func (d *digest) Sum32() uint32 {
-       return d.crc;
-}
+func (d *digest) Sum32() uint32        { return d.crc }
 
 func (d *digest) Sum() []byte {
        p := make([]byte, 4);
@@ -109,12 +99,8 @@ func (d *digest) Sum() []byte {
 
 // Checksum returns the CRC-32 checksum of data
 // using the polynomial represented by the Table.
-func Checksum(data []byte, tab *Table) uint32 {
-       return update(0, tab, data);
-}
+func Checksum(data []byte, tab *Table) uint32  { return update(0, tab, data) }
 
 // ChecksumIEEE returns the CRC-32 checksum of data
 // using the IEEE polynomial.
-func ChecksumIEEE(data []byte) uint32 {
-       return update(0, IEEETable, data);
-}
+func ChecksumIEEE(data []byte) uint32  { return update(0, IEEETable, data) }
index 0b045136b232c96c95d44c53f214c119e43a41ed..6066becde26e057edda738c5c9cb20b6cb6d1c86 100644 (file)
@@ -57,9 +57,7 @@ func (r *Response) AddHeader(key, value string) {
 
 // Given a string of the form "host", "host:port", or "[ipv6::address]:port",
 // return true if the string includes a port.
-func hasPort(s string) bool {
-       return strings.LastIndex(s, ":") > strings.LastIndex(s, "]");
-}
+func hasPort(s string) bool    { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") }
 
 // Used in Send to implement io.ReadCloser by bundling together the
 // io.BufReader through which we read the response, and the underlying
index edeec693e2a61b45fec7c4de94da055df8cbc882..c0fa69216214562fa1284734b7c91c16a7d82219 100644 (file)
@@ -168,9 +168,7 @@ type fileHandler struct {
 // with the contents of the file system rooted at root.
 // It strips prefix from the incoming requests before
 // looking up the file name in the file system.
-func FileServer(root, prefix string) Handler {
-       return &fileHandler{root, prefix};
-}
+func FileServer(root, prefix string) Handler   { return &fileHandler{root, prefix} }
 
 func (f *fileHandler) ServeHTTP(c *Conn, r *Request) {
        path := r.Url.Path;
index 71c93bb1cff76f8414d3bd83101d2ee74c171158..521b360983c173c6350f791222efc5887808cb54 100644 (file)
@@ -43,9 +43,7 @@ type badStringError struct {
        str     string;
 }
 
-func (e *badStringError) String() string {
-       return fmt.Sprintf("%s %q", e.what, e.str);
-}
+func (e *badStringError) String() string       { return fmt.Sprintf("%s %q", e.what, e.str) }
 
 // A Request represents a parsed HTTP request header.
 type Request struct {
index 3aa5c072f5d5bf80d4c3b12241e91d7370bc12fd..4b4c5837a87cb47eb9549a9bccfda7463a18f77e 100644 (file)
@@ -115,9 +115,7 @@ func (c *Conn) readRequest() (req *Request, err os.Error) {
 // Content-Type in this library, so users need not make that
 // particular call.  Calls to SetHeader after WriteHeader (or Write)
 // are ignored.
-func (c *Conn) SetHeader(hdr, val string) {
-       c.header[CanonicalHeaderKey(hdr)] = val;
-}
+func (c *Conn) SetHeader(hdr, val string)      { c.header[CanonicalHeaderKey(hdr)] = val }
 
 // WriteHeader sends an HTTP response header with status code.
 // If WriteHeader is not called explicitly, the first call to Write
@@ -326,9 +324,7 @@ func NotFound(c *Conn, req *Request) {
 
 // NotFoundHandler returns a simple request handler
 // that replies to each request with a ``404 page not found'' reply.
-func NotFoundHandler() Handler {
-       return HandlerFunc(NotFound);
-}
+func NotFoundHandler() Handler { return HandlerFunc(NotFound) }
 
 // Redirect replies to the request with a redirect to url,
 // which may be a path relative to the request path.
@@ -433,9 +429,7 @@ type ServeMux struct {
 }
 
 // NewServeMux allocates and returns a new ServeMux.
-func NewServeMux() *ServeMux {
-       return &ServeMux{make(map[string]Handler)};
-}
+func NewServeMux() *ServeMux   { return &ServeMux{make(map[string]Handler)} }
 
 // DefaultServeMux is the default ServeMux used by Serve.
 var DefaultServeMux = NewServeMux()
@@ -516,9 +510,7 @@ func (mux *ServeMux) Handle(pattern string, handler Handler) {
 
 // Handle registers the handler for the given pattern
 // in the DefaultServeMux.
-func Handle(pattern string, handler Handler) {
-       DefaultServeMux.Handle(pattern, handler);
-}
+func Handle(pattern string, handler Handler)   { DefaultServeMux.Handle(pattern, handler) }
 
 // Serve accepts incoming HTTP connections on the listener l,
 // creating a new service thread for each.  The service threads
index 172806ee5de1bcff6ed6aa894266602936fda24c..f9c6b64abb097757a65f08b0b79c4242bb19d4a5 100644 (file)
@@ -33,9 +33,7 @@ type Counter struct {
 
 // This makes Counter satisfy the expvar.Var interface, so we can export
 // it directly.
-func (ctr *Counter) String() string {
-       return fmt.Sprintf("%d", ctr.n);
-}
+func (ctr *Counter) String() string    { return fmt.Sprintf("%d", ctr.n) }
 
 func (ctr *Counter) ServeHTTP(c *http.Conn, req *http.Request) {
        switch req.Method {
index 65ad186e66246723a3ace7928c0241bbe73adbda..526c96aa23ebf6e3cf655779a36a93ef709c5c1e 100644 (file)
@@ -20,9 +20,7 @@ type URLError struct {
        Error   os.Error;
 }
 
-func (e *URLError) String() string {
-       return e.Op + " " + e.URL + ": " + e.Error.String();
-}
+func (e *URLError) String() string     { return e.Op + " " + e.URL + ": " + e.Error.String() }
 
 func ishex(c byte) bool {
        switch {
index 2b5d0964213cfa066ef2c0efb633f0faff809051..80dbb863677ff4c731476e3aef3b2fcc83ea170a 100644 (file)
@@ -21,9 +21,7 @@ type RGBA struct {
        Pixel [][]RGBAColor;
 }
 
-func (p *RGBA) ColorModel() ColorModel {
-       return RGBAColorModel;
-}
+func (p *RGBA) ColorModel() ColorModel { return RGBAColorModel }
 
 func (p *RGBA) Width() int {
        if len(p.Pixel) == 0 {
@@ -32,17 +30,11 @@ func (p *RGBA) Width() int {
        return len(p.Pixel[0]);
 }
 
-func (p *RGBA) Height() int {
-       return len(p.Pixel);
-}
+func (p *RGBA) Height() int    { return len(p.Pixel) }
 
-func (p *RGBA) At(x, y int) Color {
-       return p.Pixel[y][x];
-}
+func (p *RGBA) At(x, y int) Color      { return p.Pixel[y][x] }
 
-func (p *RGBA) Set(x, y int, c Color) {
-       p.Pixel[y][x] = toRGBAColor(c).(RGBAColor);
-}
+func (p *RGBA) Set(x, y int, c Color)  { p.Pixel[y][x] = toRGBAColor(c).(RGBAColor) }
 
 // NewRGBA returns a new RGBA with the given width and height.
 func NewRGBA(w, h int) *RGBA {
@@ -59,9 +51,7 @@ type RGBA64 struct {
        Pixel [][]RGBA64Color;
 }
 
-func (p *RGBA64) ColorModel() ColorModel {
-       return RGBA64ColorModel;
-}
+func (p *RGBA64) ColorModel() ColorModel       { return RGBA64ColorModel }
 
 func (p *RGBA64) Width() int {
        if len(p.Pixel) == 0 {
@@ -70,17 +60,11 @@ func (p *RGBA64) Width() int {
        return len(p.Pixel[0]);
 }
 
-func (p *RGBA64) Height() int {
-       return len(p.Pixel);
-}
+func (p *RGBA64) Height() int  { return len(p.Pixel) }
 
-func (p *RGBA64) At(x, y int) Color {
-       return p.Pixel[y][x];
-}
+func (p *RGBA64) At(x, y int) Color    { return p.Pixel[y][x] }
 
-func (p *RGBA64) Set(x, y int, c Color) {
-       p.Pixel[y][x] = toRGBA64Color(c).(RGBA64Color);
-}
+func (p *RGBA64) Set(x, y int, c Color)        { p.Pixel[y][x] = toRGBA64Color(c).(RGBA64Color) }
 
 // NewRGBA64 returns a new RGBA64 with the given width and height.
 func NewRGBA64(w, h int) *RGBA64 {
@@ -97,9 +81,7 @@ type NRGBA struct {
        Pixel [][]NRGBAColor;
 }
 
-func (p *NRGBA) ColorModel() ColorModel {
-       return NRGBAColorModel;
-}
+func (p *NRGBA) ColorModel() ColorModel        { return NRGBAColorModel }
 
 func (p *NRGBA) Width() int {
        if len(p.Pixel) == 0 {
@@ -108,17 +90,11 @@ func (p *NRGBA) Width() int {
        return len(p.Pixel[0]);
 }
 
-func (p *NRGBA) Height() int {
-       return len(p.Pixel);
-}
+func (p *NRGBA) Height() int   { return len(p.Pixel) }
 
-func (p *NRGBA) At(x, y int) Color {
-       return p.Pixel[y][x];
-}
+func (p *NRGBA) At(x, y int) Color     { return p.Pixel[y][x] }
 
-func (p *NRGBA) Set(x, y int, c Color) {
-       p.Pixel[y][x] = toNRGBAColor(c).(NRGBAColor);
-}
+func (p *NRGBA) Set(x, y int, c Color) { p.Pixel[y][x] = toNRGBAColor(c).(NRGBAColor) }
 
 // NewNRGBA returns a new NRGBA with the given width and height.
 func NewNRGBA(w, h int) *NRGBA {
@@ -135,9 +111,7 @@ type NRGBA64 struct {
        Pixel [][]NRGBA64Color;
 }
 
-func (p *NRGBA64) ColorModel() ColorModel {
-       return NRGBA64ColorModel;
-}
+func (p *NRGBA64) ColorModel() ColorModel      { return NRGBA64ColorModel }
 
 func (p *NRGBA64) Width() int {
        if len(p.Pixel) == 0 {
@@ -146,17 +120,11 @@ func (p *NRGBA64) Width() int {
        return len(p.Pixel[0]);
 }
 
-func (p *NRGBA64) Height() int {
-       return len(p.Pixel);
-}
+func (p *NRGBA64) Height() int { return len(p.Pixel) }
 
-func (p *NRGBA64) At(x, y int) Color {
-       return p.Pixel[y][x];
-}
+func (p *NRGBA64) At(x, y int) Color   { return p.Pixel[y][x] }
 
-func (p *NRGBA64) Set(x, y int, c Color) {
-       p.Pixel[y][x] = toNRGBA64Color(c).(NRGBA64Color);
-}
+func (p *NRGBA64) Set(x, y int, c Color)       { p.Pixel[y][x] = toNRGBA64Color(c).(NRGBA64Color) }
 
 // NewNRGBA64 returns a new NRGBA64 with the given width and height.
 func NewNRGBA64(w, h int) *NRGBA64 {
@@ -214,9 +182,7 @@ type Paletted struct {
        Palette PalettedColorModel;
 }
 
-func (p *Paletted) ColorModel() ColorModel {
-       return p.Palette;
-}
+func (p *Paletted) ColorModel() ColorModel     { return p.Palette }
 
 func (p *Paletted) Width() int {
        if len(p.Pixel) == 0 {
@@ -225,13 +191,9 @@ func (p *Paletted) Width() int {
        return len(p.Pixel[0]);
 }
 
-func (p *Paletted) Height() int {
-       return len(p.Pixel);
-}
+func (p *Paletted) Height() int        { return len(p.Pixel) }
 
-func (p *Paletted) At(x, y int) Color {
-       return p.Palette[p.Pixel[y][x]];
-}
+func (p *Paletted) At(x, y int) Color  { return p.Palette[p.Pixel[y][x]] }
 
 func (p *Paletted) ColorIndexAt(x, y int) uint8 {
        return p.Pixel[y][x];
index c8a2b076b28cbe9592d85267d04dd8d5d5d07ef4..9ea338d07d0b356131a5ff015f3de9d4bab9c1fb 100644 (file)
@@ -63,9 +63,7 @@ type decoder struct {
 // A FormatError reports that the input is not a valid PNG.
 type FormatError string
 
-func (e FormatError) String() string {
-       return "invalid PNG format: " + string(e);
-}
+func (e FormatError) String() string   { return "invalid PNG format: " + string(e) }
 
 var chunkOrderError = FormatError("chunk out of order")
 
@@ -74,16 +72,12 @@ type IDATDecodingError struct {
        Err os.Error;
 }
 
-func (e IDATDecodingError) String() string {
-       return "IDAT decoding error: " + e.Err.String();
-}
+func (e IDATDecodingError) String() string     { return "IDAT decoding error: " + e.Err.String() }
 
 // An UnsupportedError reports that the input uses a valid but unimplemented PNG feature.
 type UnsupportedError string
 
-func (e UnsupportedError) String() string {
-       return "unsupported PNG feature: " + string(e);
-}
+func (e UnsupportedError) String() string      { return "unsupported PNG feature: " + string(e) }
 
 // Big-endian.
 func parseUint32(b []uint8) uint32 {
index 9ff4e1e7277de9e66343856de640c15c1d1fb49f..ceb72598e39a2d55c541afeae4c452d6fd31c355 100644 (file)
@@ -312,9 +312,7 @@ func (e *encoder) writeIDATs() {
        e.err = bw.Flush();
 }
 
-func (e *encoder) writeIEND() {
-       e.writeChunk(e.tmp[0:0], "IEND");
-}
+func (e *encoder) writeIEND()  { e.writeChunk(e.tmp[0:0], "IEND") }
 
 // Encode writes the Image m to w in PNG format. Any Image may be encoded, but
 // images that are not image.NRGBA might be encoded lossily.
index 50b0873fa121795d6201dfbad2a4ddd895bee7f1..01157c157e0ec2bf3086235ccb91af4499fc1397 100644 (file)
@@ -243,9 +243,7 @@ func Copy(dst Writer, src Reader) (written int64, err os.Error) {
 
 // LimitReader returns a Reader that reads from r
 // but stops with os.EOF after n bytes.
-func LimitReader(r Reader, n int64) Reader {
-       return &limitedReader{r, n};
-}
+func LimitReader(r Reader, n int64) Reader     { return &limitedReader{r, n} }
 
 type limitedReader struct {
        r       Reader;
@@ -321,6 +319,4 @@ func (s *SectionReader) ReadAt(p []byte, off int64) (n int, err os.Error) {
 }
 
 // Size returns the size of the section in bytes.
-func (s *SectionReader) Size() int64 {
-       return s.limit - s.base;
-}
+func (s *SectionReader) Size() int64   { return s.limit - s.base }
index ff52988b20e112580af2c84fa76ddd0411b40e04..743e4c468f907d056c7913ef1782b46a69ced225 100644 (file)
@@ -166,9 +166,7 @@ func (r *PipeReader) CloseWithError(rerr os.Error) os.Error {
        return r.p.CloseReader(rerr);
 }
 
-func (r *PipeReader) finish() {
-       r.Close();
-}
+func (r *PipeReader) finish()  { r.Close() }
 
 // Write half of pipe.
 type PipeWriter struct {
@@ -206,9 +204,7 @@ func (w *PipeWriter) CloseWithError(werr os.Error) os.Error {
        return w.p.CloseWriter(werr);
 }
 
-func (w *PipeWriter) finish() {
-       w.Close();
-}
+func (w *PipeWriter) finish()  { w.Close() }
 
 // Pipe creates a synchronous in-memory pipe.
 // It can be used to connect code expecting an io.Reader
index 4e3c0c42bd524135bb77f659c90e0c6c39005030..8c5c710b710956cbe264d24e456a1cf09d117e53 100644 (file)
@@ -48,15 +48,9 @@ func WriteFile(filename string, data []byte, perm int) os.Error {
 // A dirList implements sort.Interface.
 type dirList []*os.Dir
 
-func (d dirList) Len() int {
-       return len(d);
-}
-func (d dirList) Less(i, j int) bool {
-       return d[i].Name < d[j].Name;
-}
-func (d dirList) Swap(i, j int) {
-       d[i], d[j] = d[j], d[i];
-}
+func (d dirList) Len() int             { return len(d) }
+func (d dirList) Less(i, j int) bool   { return d[i].Name < d[j].Name }
+func (d dirList) Swap(i, j int)                { d[i], d[j] = d[j], d[i] }
 
 // ReadDir reads the directory named by dirname and returns
 // a list of sorted directory entries.
index d53c4f6b0bdd3ba533df43c80a9f20366efe7baf..a8ee836641f0f9ff07d5b41117243251b43f8ed6 100644 (file)
@@ -56,51 +56,29 @@ type _Null struct{}
 // Null is the JSON object representing the null data object.
 var Null Json = &_Null{}
 
-func (*_Null) Kind() int {
-       return NullKind;
-}
-func (*_Null) String() string {
-       return "null";
-}
-func (*_Null) Number() float64 {
-       return 0;
-}
-func (*_Null) Bool() bool {
-       return false;
-}
-func (*_Null) Get(s string) Json {
-       return Null;
-}
-func (*_Null) Elem(int) Json {
-       return Null;
-}
-func (*_Null) Len() int {
-       return 0;
-}
+func (*_Null) Kind() int               { return NullKind }
+func (*_Null) String() string          { return "null" }
+func (*_Null) Number() float64         { return 0 }
+func (*_Null) Bool() bool              { return false }
+func (*_Null) Get(s string) Json       { return Null }
+func (*_Null) Elem(int) Json           { return Null }
+func (*_Null) Len() int                        { return 0 }
 
 type _String struct {
        s       string;
        _Null;
 }
 
-func (j *_String) Kind() int {
-       return StringKind;
-}
-func (j *_String) String() string {
-       return j.s;
-}
+func (j *_String) Kind() int           { return StringKind }
+func (j *_String) String() string      { return j.s }
 
 type _Number struct {
        f       float64;
        _Null;
 }
 
-func (j *_Number) Kind() int {
-       return NumberKind;
-}
-func (j *_Number) Number() float64 {
-       return j.f;
-}
+func (j *_Number) Kind() int           { return NumberKind }
+func (j *_Number) Number() float64     { return j.f }
 func (j *_Number) String() string {
        if math.Floor(j.f) == j.f {
                return fmt.Sprintf("%.0f", j.f);
@@ -113,12 +91,8 @@ type _Array struct {
        _Null;
 }
 
-func (j *_Array) Kind() int {
-       return ArrayKind;
-}
-func (j *_Array) Len() int {
-       return j.a.Len();
-}
+func (j *_Array) Kind() int    { return ArrayKind }
+func (j *_Array) Len() int     { return j.a.Len() }
 func (j *_Array) Elem(i int) Json {
        if i < 0 || i >= j.a.Len() {
                return Null;
@@ -142,12 +116,8 @@ type _Bool struct {
        _Null;
 }
 
-func (j *_Bool) Kind() int {
-       return BoolKind;
-}
-func (j *_Bool) Bool() bool {
-       return j.b;
-}
+func (j *_Bool) Kind() int     { return BoolKind }
+func (j *_Bool) Bool() bool    { return j.b }
 func (j *_Bool) String() string {
        if j.b {
                return "true";
@@ -160,12 +130,8 @@ type _Map struct {
        _Null;
 }
 
-func (j *_Map) Kind() int {
-       return MapKind;
-}
-func (j *_Map) Len() int {
-       return len(j.m);
-}
+func (j *_Map) Kind() int      { return MapKind }
+func (j *_Map) Len() int       { return len(j.m) }
 func (j *_Map) Get(s string) Json {
        if j.m == nil {
                return Null;
@@ -313,38 +279,22 @@ func (b *_JsonBuilder) Get() Json {
        return nil;
 }
 
-func (b *_JsonBuilder) Float64(f float64) {
-       b.Put(&_Number{f, _Null{}});
-}
+func (b *_JsonBuilder) Float64(f float64)      { b.Put(&_Number{f, _Null{}}) }
 
-func (b *_JsonBuilder) Int64(i int64) {
-       b.Float64(float64(i));
-}
+func (b *_JsonBuilder) Int64(i int64)  { b.Float64(float64(i)) }
 
-func (b *_JsonBuilder) Uint64(i uint64) {
-       b.Float64(float64(i));
-}
+func (b *_JsonBuilder) Uint64(i uint64)        { b.Float64(float64(i)) }
 
-func (b *_JsonBuilder) Bool(tf bool) {
-       b.Put(&_Bool{tf, _Null{}});
-}
+func (b *_JsonBuilder) Bool(tf bool)   { b.Put(&_Bool{tf, _Null{}}) }
 
-func (b *_JsonBuilder) Null() {
-       b.Put(Null);
-}
+func (b *_JsonBuilder) Null()  { b.Put(Null) }
 
-func (b *_JsonBuilder) String(s string) {
-       b.Put(&_String{s, _Null{}});
-}
+func (b *_JsonBuilder) String(s string)        { b.Put(&_String{s, _Null{}}) }
 
 
-func (b *_JsonBuilder) Array() {
-       b.Put(&_Array{vector.New(0), _Null{}});
-}
+func (b *_JsonBuilder) Array() { b.Put(&_Array{vector.New(0), _Null{}}) }
 
-func (b *_JsonBuilder) Map() {
-       b.Put(&_Map{make(map[string]Json), _Null{}});
-}
+func (b *_JsonBuilder) Map()   { b.Put(&_Map{make(map[string]Json), _Null{}}) }
 
 func (b *_JsonBuilder) Elem(i int) Builder {
        bb := new(_JsonBuilder);
@@ -364,8 +314,7 @@ func (b *_JsonBuilder) Key(k string) Builder {
        return bb;
 }
 
-func (b *_JsonBuilder) Flush() {
-}
+func (b *_JsonBuilder) Flush() {}
 
 // StringToJson parses the string s as a JSON-syntax string
 // and returns the generic JSON object representation.
index ba291e940a17ea7651346a1edcbe482fd379f06d..26c01fe8506a41495262caa738ff417bb85a4765 100644 (file)
@@ -183,9 +183,7 @@ func punct(c byte) bool {
        return c == '"' || c == '[' || c == ']' || c == ':' || c == '{' || c == '}' || c == ',';
 }
 
-func white(c byte) bool {
-       return c == ' ' || c == '\t' || c == '\n' || c == '\v';
-}
+func white(c byte) bool        { return c == ' ' || c == '\t' || c == '\n' || c == '\v' }
 
 func skipwhite(p string, i int) int {
        for i < len(p) && white(p[i]) {
index 11cccdce9e3cfa2a763ce53589b9c285113a9642..37728d38bba490531702aec006738b4a95852769 100644 (file)
@@ -113,8 +113,7 @@ func (b *structBuilder) Float64(f float64) {
        }
 }
 
-func (b *structBuilder) Null() {
-}
+func (b *structBuilder) Null() {}
 
 func (b *structBuilder) String(s string) {
        if b == nil {
index 221016674491fabc164c7077eb82016d4fa66784..e5a28031bf477191efb08e672c8e4944859f0969 100644 (file)
@@ -145,51 +145,31 @@ func (l *Logger) Output(calldepth int, s string) {
 }
 
 // Logf is analogous to Printf() for a Logger.
-func (l *Logger) Logf(format string, v ...) {
-       l.Output(2, fmt.Sprintf(format, v));
-}
+func (l *Logger) Logf(format string, v ...)    { l.Output(2, fmt.Sprintf(format, v)) }
 
 // Log is analogouts to Print() for a Logger.
-func (l *Logger) Log(v ...) {
-       l.Output(2, fmt.Sprintln(v));
-}
+func (l *Logger) Log(v ...)    { l.Output(2, fmt.Sprintln(v)) }
 
 // Stdout is a helper function for easy logging to stdout. It is analogous to Print().
-func Stdout(v ...) {
-       stdout.Output(2, fmt.Sprint(v));
-}
+func Stdout(v ...)     { stdout.Output(2, fmt.Sprint(v)) }
 
 // Stderr is a helper function for easy logging to stderr. It is analogous to Fprint(os.Stderr).
-func Stderr(v ...) {
-       stderr.Output(2, fmt.Sprintln(v));
-}
+func Stderr(v ...)     { stderr.Output(2, fmt.Sprintln(v)) }
 
 // Stdoutf is a helper functions for easy formatted logging to stdout. It is analogous to Printf().
-func Stdoutf(format string, v ...) {
-       stdout.Output(2, fmt.Sprintf(format, v));
-}
+func Stdoutf(format string, v ...)     { stdout.Output(2, fmt.Sprintf(format, v)) }
 
 // Stderrf is a helper function for easy formatted logging to stderr. It is analogous to Fprintf(os.Stderr).
-func Stderrf(format string, v ...) {
-       stderr.Output(2, fmt.Sprintf(format, v));
-}
+func Stderrf(format string, v ...)     { stderr.Output(2, fmt.Sprintf(format, v)) }
 
 // Exit is equivalent to Stderr() followed by a call to os.Exit(1).
-func Exit(v ...) {
-       exit.Output(2, fmt.Sprintln(v));
-}
+func Exit(v ...)       { exit.Output(2, fmt.Sprintln(v)) }
 
 // Exitf is equivalent to Stderrf() followed by a call to os.Exit(1).
-func Exitf(format string, v ...) {
-       exit.Output(2, fmt.Sprintf(format, v));
-}
+func Exitf(format string, v ...)       { exit.Output(2, fmt.Sprintf(format, v)) }
 
 // Crash is equivalent to Stderr() followed by a call to panic().
-func Crash(v ...) {
-       crash.Output(2, fmt.Sprintln(v));
-}
+func Crash(v ...)      { crash.Output(2, fmt.Sprintln(v)) }
 
 // Crashf is equivalent to Stderrf() followed by a call to panic().
-func Crashf(format string, v ...) {
-       crash.Output(2, fmt.Sprintf(format, v));
-}
+func Crashf(format string, v ...)      { crash.Output(2, fmt.Sprintf(format, v)) }
index 066f89da81456f8e21ee1ab1fc06482232ab6854..06c5be20073751b4355701f13f7dc3ee4105c56c 100644 (file)
@@ -168,12 +168,8 @@ func tolerance(a, b, e float64) bool {
        }
        return d < e;
 }
-func close(a, b float64) bool {
-       return tolerance(a, b, 1e-14);
-}
-func veryclose(a, b float64) bool {
-       return tolerance(a, b, 4e-16);
-}
+func close(a, b float64) bool          { return tolerance(a, b, 1e-14) }
+func veryclose(a, b float64) bool      { return tolerance(a, b, 4e-16) }
 
 func TestAsin(t *testing.T) {
        for i := 0; i < len(vf); i++ {
index 100d006236de185df86c4db10a001b172d4e29fa..3084ed508f9741d31cfc81a525b956f3e42f827e 100644 (file)
@@ -25,9 +25,7 @@ func Inf(sign int) float64 {
 }
 
 // NaN returns an IEEE 754 ``not-a-number'' value.
-func NaN() float64 {
-       return Float64frombits(uvnan);
-}
+func NaN() float64     { return Float64frombits(uvnan) }
 
 // IsNaN returns whether f is an IEEE 754 ``not-a-number'' value.
 func IsNaN(f float64) (is bool) {
index 7f2c9111d773e55f2577115c308915e2f73619c4..cb3110fb2efc796f6da9b8edf2d792758a501080 100644 (file)
@@ -19,6 +19,4 @@ func Floor(x float64) float64 {
 }
 
 // Ceil returns the least integer value greater than or equal to x.
-func Ceil(x float64) float64 {
-       return -Floor(-x);
-}
+func Ceil(x float64) float64   { return -Floor(-x) }
index 973aef5544fd551888d3072d80adc32ebff3d564..740d6778bd3af6dd5a1dd2cdffc1dc90403a623e 100644 (file)
@@ -58,6 +58,4 @@ func Cos(x float64) float64 {
 }
 
 // Sin returns the sine of x.
-func Sin(x float64) float64 {
-       return sinus(x, 0);
-}
+func Sin(x float64) float64    { return sinus(x, 0) }
index 187dcc225f60832d4d1f84d6a2a7a4f859e69df2..182b2e13b7d7f6d36fb92e7e281e5233ba48115d 100644 (file)
@@ -7,23 +7,15 @@ package math
 import "unsafe"
 
 // Float32bits returns the IEEE 754 binary representation of f.
-func Float32bits(f float32) uint32 {
-       return *(*uint32)(unsafe.Pointer(&f));
-}
+func Float32bits(f float32) uint32     { return *(*uint32)(unsafe.Pointer(&f)) }
 
 // Float32frombits returns the floating point number corresponding
 // to the IEEE 754 binary representation b.
-func Float32frombits(b uint32) float32 {
-       return *(*float32)(unsafe.Pointer(&b));
-}
+func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) }
 
 // Float64bits returns the IEEE 754 binary representation of f.
-func Float64bits(f float64) uint64 {
-       return *(*uint64)(unsafe.Pointer(&f));
-}
+func Float64bits(f float64) uint64     { return *(*uint64)(unsafe.Pointer(&f)) }
 
 // Float64frombits returns the floating point number corresponding
 // the IEEE 754 binary representation b.
-func Float64frombits(b uint64) float64 {
-       return *(*float64)(unsafe.Pointer(&b));
-}
+func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)) }
index 3c283001b364c021356ed0b0624e70fda29c869c..4a3b7dcc11c56e975c3e94aa6119d37b68fe1eb1 100644 (file)
@@ -178,9 +178,7 @@ func tryOneName(cfg *_DNS_Config, name string) (addrs []string, err os.Error) {
 var cfg *_DNS_Config
 var dnserr os.Error
 
-func loadConfig() {
-       cfg, dnserr = _DNS_ReadConfig();
-}
+func loadConfig()      { cfg, dnserr = _DNS_ReadConfig() }
 
 func isDomainName(s string) bool {
        // Requirements on DNS name:
index 93ab3aac0eaa99a32db4b766d334bf0a2ee0686c..c7c27e3441cd7e6a711a0785298cbbdd65a42f51 100644 (file)
@@ -231,9 +231,7 @@ type _DNS_RR_A struct {
        A       uint32  "ipv4";
 }
 
-func (rr *_DNS_RR_A) Header() *_DNS_RR_Header {
-       return &rr.Hdr;
-}
+func (rr *_DNS_RR_A) Header() *_DNS_RR_Header  { return &rr.Hdr }
 
 
 // Packing and unpacking.
@@ -521,9 +519,7 @@ func printStructValue(val *reflect.StructValue) string {
        return s;
 }
 
-func printStruct(any interface{}) string {
-       return printStructValue(structValue(any));
-}
+func printStruct(any interface{}) string       { return printStructValue(structValue(any)) }
 
 // Resource record packer.
 func packRR(rr _DNS_RR, msg []byte, off int) (off2 int, ok bool) {
index 3c326461a856b17217ee3bbeca111492f234a5da..bcb7372125f1bbd040212d8165bcf69f52175b10 100644 (file)
@@ -270,9 +270,7 @@ func (s *pollServer) Run() {
 
 var wakeupbuf [1]byte
 
-func (s *pollServer) Wakeup() {
-       s.pw.Write(&wakeupbuf);
-}
+func (s *pollServer) Wakeup()  { s.pw.Write(&wakeupbuf) }
 
 func (s *pollServer) WaitRead(fd *netFD) {
        s.cr <- fd;
index 8ae9f687c02c1b6bddcaaadae46909392a9d6e7d..45acad6995f4342309ed3a010fda96e6f7916fae 100644 (file)
@@ -107,6 +107,4 @@ func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) {
        return fd, mode, nil;
 }
 
-func (p *pollster) Close() os.Error {
-       return os.NewSyscallError("close", syscall.Close(p.kq));
-}
+func (p *pollster) Close() os.Error    { return os.NewSyscallError("close", syscall.Close(p.kq)) }
index 36a012b2a556280f828edf3a2b60d521f313cc34..31679648678148394a73e9ee522535d262dbe888 100644 (file)
@@ -23,14 +23,11 @@ func (p *pollster) AddFD(fd int, mode int, repeat bool) os.Error {
 func (p *pollster) StopWaiting(fd int, bits uint) {
 }
 
-func (p *pollster) DelFD(fd int, mode int) {
-}
+func (p *pollster) DelFD(fd int, mode int)     {}
 
 func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) {
        _, err = newpollster();
        return;
 }
 
-func (p *pollster) Close() os.Error {
-       return nil;
-}
+func (p *pollster) Close() os.Error    { return nil }
index 76a64e76e033ae8f37e48195bacb5150dd32062c..fd37155a2c1a2623413b8f75237d8286805b48c7 100644 (file)
@@ -30,9 +30,7 @@ var preferIPv4 = !kernelSupportsIPv6()
 // TODO(rsc): if syscall.OS == "linux", we're supposd to read
 // /proc/sys/net/core/somaxconn,
 // to take advantage of kernels that have raised the limit.
-func listenBacklog() int {
-       return syscall.SOMAXCONN;
-}
+func listenBacklog() int       { return syscall.SOMAXCONN }
 
 // Internet sockets (TCP, UDP)
 
index 9c3762ae453c7c0dec783b890ec32ce5ff048e73..d649756ed515a6bee2de3e3e69a39acd215c2b41 100644 (file)
@@ -266,6 +266,4 @@ func (e *AddrError) String() string {
 
 type UnknownNetworkError string
 
-func (e UnknownNetworkError) String() string {
-       return "unknown network " + string(e);
-}
+func (e UnknownNetworkError) String() string   { return "unknown network " + string(e) }
index a9ba2d22ee602b7c0f3e001af17277127d83f6fd..9ed3f2dbdae71cb33bb1c989ae4f95b23dd86626 100644 (file)
@@ -17,9 +17,7 @@ type file struct {
        data    []byte;
 }
 
-func (f *file) close() {
-       f.file.Close();
-}
+func (f *file) close() { f.file.Close() }
 
 func (f *file) getLineFromData() (s string, ok bool) {
        data := f.data;
@@ -104,9 +102,7 @@ func splitAtBytes(s string, t string) []string {
        return a[0:n];
 }
 
-func getFields(s string) []string {
-       return splitAtBytes(s, " \r\t\n");
-}
+func getFields(s string) []string      { return splitAtBytes(s, " \r\t\n") }
 
 // Bigger than we need, not too big to worry about overflow
 const big = 0xFFFFFF
index 2c84be03c65ca7dcb4eb6017934015f17a9f940b..a49a73d1b07baa385f84e50fcb30c5a0e0fbb06b 100644 (file)
@@ -28,13 +28,9 @@ type TCPAddr struct {
 }
 
 // Network returns the address's network name, "tcp".
-func (a *TCPAddr) Network() string {
-       return "tcp";
-}
+func (a *TCPAddr) Network() string     { return "tcp" }
 
-func (a *TCPAddr) String() string {
-       return joinHostPort(a.IP.String(), itoa(a.Port));
-}
+func (a *TCPAddr) String() string      { return joinHostPort(a.IP.String(), itoa(a.Port)) }
 
 func (a *TCPAddr) family() int {
        if a == nil || len(a.IP) <= 4 {
@@ -81,9 +77,7 @@ func newTCPConn(fd *netFD) *TCPConn {
        return c;
 }
 
-func (c *TCPConn) ok() bool {
-       return c != nil && c.fd != nil;
-}
+func (c *TCPConn) ok() bool    { return c != nil && c.fd != nil }
 
 // Implementation of the Conn interface - see Conn for documentation.
 
@@ -283,6 +277,4 @@ func (l *TCPListener) Close() os.Error {
 }
 
 // Addr returns the listener's network address, a *TCPAddr.
-func (l *TCPListener) Addr() Addr {
-       return l.fd.laddr;
-}
+func (l *TCPListener) Addr() Addr      { return l.fd.laddr }
index 0e03b63f99f1adb1e54c7d13643818cf0f3f4b24..acac3c75db8b5e2dc24bca41081c5ad144e271b0 100644 (file)
@@ -28,9 +28,7 @@ func testTimeout(t *testing.T, network, addr string) {
        }
 }
 
-func TestTimeoutUDP(t *testing.T) {
-       testTimeout(t, "udp", "127.0.0.1:53");
-}
+func TestTimeoutUDP(t *testing.T)      { testTimeout(t, "udp", "127.0.0.1:53") }
 
 func TestTimeoutTCP(t *testing.T) {
        // 74.125.19.99 is www.google.com.
index f3b6bf6a4309da1a9583bfb6fa3144291842a41c..4449e837931daa0c10c7690ca4e424b365b54f8e 100644 (file)
@@ -28,14 +28,9 @@ type UDPAddr struct {
 }
 
 // Network returns the address's network name, "udp".
-func (a *UDPAddr) Network() string {
-       return "udp";
-}
-
-func (a *UDPAddr) String() string {
-       return joinHostPort(a.IP.String(), itoa(a.Port));
+func (a *UDPAddr) Network() string     { return "udp" }
 
-}
+func (a *UDPAddr) String() string      { return joinHostPort(a.IP.String(), itoa(a.Port)) }
 
 func (a *UDPAddr) family() int {
        if a == nil || len(a.IP) <= 4 {
@@ -76,13 +71,9 @@ type UDPConn struct {
        fd *netFD;
 }
 
-func newUDPConn(fd *netFD) *UDPConn {
-       return &UDPConn{fd};
-}
+func newUDPConn(fd *netFD) *UDPConn    { return &UDPConn{fd} }
 
-func (c *UDPConn) ok() bool {
-       return c != nil && c.fd != nil;
-}
+func (c *UDPConn) ok() bool    { return c != nil && c.fd != nil }
 
 // Implementation of the Conn interface - see Conn for documentation.
 
index b30d7f2d4583a5c2515504afb1efb68899c043e7..033f650c3bcd7772e3021a1408facdb4e5fa048c 100644 (file)
@@ -127,13 +127,9 @@ type UnixConn struct {
        fd *netFD;
 }
 
-func newUnixConn(fd *netFD) *UnixConn {
-       return &UnixConn{fd};
-}
+func newUnixConn(fd *netFD) *UnixConn  { return &UnixConn{fd} }
 
-func (c *UnixConn) ok() bool {
-       return c != nil && c.fd != nil;
-}
+func (c *UnixConn) ok() bool   { return c != nil && c.fd != nil }
 
 // Implementation of the Conn interface - see Conn for documentation.
 
@@ -400,9 +396,7 @@ func (l *UnixListener) Close() os.Error {
 }
 
 // Addr returns the listener's network address.
-func (l *UnixListener) Addr() Addr {
-       return l.fd.laddr;
-}
+func (l *UnixListener) Addr() Addr     { return l.fd.laddr }
 
 // ListenUnixgram listens for incoming Unix datagram packets addressed to the
 // local address laddr.  The returned connection c's ReadFrom
index e2e6c2c09e78c4fa74abf60d2ffec1bda4da0061..e89e05e81d319877e9359e41916adf69051c4db7 100644 (file)
@@ -11,9 +11,7 @@ import (
 
 var ncall int
 
-func call() {
-       ncall++;
-}
+func call()    { ncall++ }
 
 func TestDo(t *testing.T) {
        ncall = 0;
index 809116cff06cec0a5d3760c9e5804ad11cecacbf..6bbf5371edb3aa3920e74fa1058ad1e898019739 100644 (file)
@@ -15,26 +15,20 @@ type Error interface {
 // Error.
 type ErrorString string
 
-func (e ErrorString) String() string {
-       return string(e);
-}
+func (e ErrorString) String() string   { return string(e) }
 
 // Note: If the name of the function NewError changes,
 // pkg/go/doc/doc.go should be adjusted since it hardwires
 // this name in a heuristic.
 
 // NewError converts s to an ErrorString, which satisfies the Error interface.
-func NewError(s string) Error {
-       return ErrorString(s);
-}
+func NewError(s string) Error  { return ErrorString(s) }
 
 // Errno is the Unix error number.  Names such as EINVAL are simple
 // wrappers to convert the error number into an Error.
 type Errno int64
 
-func (e Errno) String() string {
-       return syscall.Errstr(int(e));
-}
+func (e Errno) String() string { return syscall.Errstr(int(e)) }
 
 // Commonly known Unix errors.
 var (
@@ -84,9 +78,7 @@ type PathError struct {
        Error   Error;
 }
 
-func (e *PathError) String() string {
-       return e.Op + " " + e.Path + ": " + e.Error.String();
-}
+func (e *PathError) String() string    { return e.Op + " " + e.Path + ": " + e.Error.String() }
 
 // SyscallError records an error from a specific system call.
 type SyscallError struct {
@@ -94,9 +86,7 @@ type SyscallError struct {
        Errno   Errno;
 }
 
-func (e *SyscallError) String() string {
-       return e.Syscall + ": " + e.Errno.String();
-}
+func (e *SyscallError) String() string { return e.Syscall + ": " + e.Errno.String() }
 
 // Note: If the name of the function NewSyscallError changes,
 // pkg/go/doc/doc.go should be adjusted since it hardwires
index 79d25b2dc0d5d0de634a429a1c176863c7ecd46a..a279bf428e9bd50538a7426cc34bf8685355d939 100644 (file)
@@ -145,11 +145,7 @@ func (w Waitmsg) String() string {
 }
 
 // Getpid returns the process id of the caller.
-func Getpid() int {
-       return syscall.Getpid();
-}
+func Getpid() int      { return syscall.Getpid() }
 
 // Getppid returns the process id of the caller's parent.
-func Getppid() int {
-       return syscall.Getppid();
-}
+func Getppid() int     { return syscall.Getppid() }
index 578bc2e9e4ea384e520cbbb1b78da08092b7db1c..0afdca39cc305bcd819ff0de49c831056d5c432a 100644 (file)
@@ -26,14 +26,10 @@ type File struct {
 }
 
 // Fd returns the integer Unix file descriptor referencing the open file.
-func (file *File) Fd() int {
-       return file.fd;
-}
+func (file *File) Fd() int     { return file.fd }
 
 // Name returns the name of the file as presented to Open.
-func (file *File) Name() string {
-       return file.name;
-}
+func (file *File) Name() string        { return file.name }
 
 // NewFile returns a new File with the given file descriptor and name.
 func NewFile(fd int, name string) *File {
@@ -102,9 +98,7 @@ func (file *File) Close() Error {
 
 type eofError int
 
-func (eofError) String() string {
-       return "EOF";
-}
+func (eofError) String() string        { return "EOF" }
 
 // EOF is the Error returned by Read when no more input is available.
 // Functions should return EOF only to signal a graceful end of input.
index 0dd295edf55dc5ee37e373cf7aaa1ee11230f935..e780cfc9ad355b8d19a0228153b87db3da990b62 100644 (file)
@@ -13,24 +13,16 @@ var Envs []string   // provided by runtime
 
 
 // Getuid returns the numeric user id of the caller.
-func Getuid() int {
-       return syscall.Getuid();
-}
+func Getuid() int      { return syscall.Getuid() }
 
 // Geteuid returns the numeric effective user id of the caller.
-func Geteuid() int {
-       return syscall.Geteuid();
-}
+func Geteuid() int     { return syscall.Geteuid() }
 
 // Getgid returns the numeric group id of the caller.
-func Getgid() int {
-       return syscall.Getgid();
-}
+func Getgid() int      { return syscall.Getgid() }
 
 // Getegid returns the numeric effective group id of the caller.
-func Getegid() int {
-       return syscall.Getegid();
-}
+func Getegid() int     { return syscall.Getegid() }
 
 // Getgroups returns a list of the numeric ids of groups that the caller belongs to.
 func Getgroups() ([]int, Error) {
@@ -40,6 +32,4 @@ func Getgroups() ([]int, Error) {
 
 // Exit causes the current program to exit with the given status code.
 // Conventionally, code zero indicates success, non-zero an error.
-func Exit(code int) {
-       syscall.Exit(code);
-}
+func Exit(code int)    { syscall.Exit(code) }
index 0bea28095960cc988170cfea348490192fad08de..51694a0467b762ba0e8ec367f8352da827174c1f 100644 (file)
@@ -4,6 +4,4 @@
 
 package os
 
-func Hostname() (name string, err Error) {
-       return "nacl", nil;
-}
+func Hostname() (name string, err Error)       { return "nacl", nil }
index 7ed547c9b76181c71444fd99a46b35b050adac07..ec3b4e11b471e14275f3245e77c8f87bb0b89caa 100644 (file)
@@ -10,9 +10,7 @@ import "syscall"
 // OS-specific routines in this directory convert the OS-local versions to these.
 
 // Getpagesize returns the underlying system's memory page size.
-func Getpagesize() int {
-       return syscall.Getpagesize();
-}
+func Getpagesize() int { return syscall.Getpagesize() }
 
 // A Dir describes a file and is returned by Stat, Fstat, and Lstat
 type Dir struct {
@@ -34,41 +32,25 @@ type Dir struct {
 }
 
 // IsFifo reports whether the Dir describes a FIFO file.
-func (dir *Dir) IsFifo() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFIFO;
-}
+func (dir *Dir) IsFifo() bool  { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFIFO }
 
 // IsChar reports whether the Dir describes a character special file.
-func (dir *Dir) IsChar() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFCHR;
-}
+func (dir *Dir) IsChar() bool  { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFCHR }
 
 // IsDirectory reports whether the Dir describes a directory.
-func (dir *Dir) IsDirectory() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFDIR;
-}
+func (dir *Dir) IsDirectory() bool     { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFDIR }
 
 // IsBlock reports whether the Dir describes a block special file.
-func (dir *Dir) IsBlock() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFBLK;
-}
+func (dir *Dir) IsBlock() bool { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFBLK }
 
 // IsRegular reports whether the Dir describes a regular file.
-func (dir *Dir) IsRegular() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFREG;
-}
+func (dir *Dir) IsRegular() bool       { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFREG }
 
 // IsSymlink reports whether the Dir describes a symbolic link.
-func (dir *Dir) IsSymlink() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFLNK;
-}
+func (dir *Dir) IsSymlink() bool       { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFLNK }
 
 // IsSocket reports whether the Dir describes a socket.
-func (dir *Dir) IsSocket() bool {
-       return (dir.Mode & syscall.S_IFMT) == syscall.S_IFSOCK;
-}
+func (dir *Dir) IsSocket() bool        { return (dir.Mode & syscall.S_IFMT) == syscall.S_IFSOCK }
 
 // Permission returns the file permission bits.
-func (dir *Dir) Permission() int {
-       return int(dir.Mode & 0777);
-}
+func (dir *Dir) Permission() int       { return int(dir.Mode & 0777) }
index c0fdadb84e6a2f2e8e127288ffe8cbfec0b48144..e8ed627f7e9af7ec5b2c558e53c71cc0429a89cb 100644 (file)
@@ -63,9 +63,7 @@ func (noDiffType) Apply(old []byte) ([]byte, os.Error) {
 // A SyntaxError represents a syntax error encountered while parsing a patch.
 type SyntaxError string
 
-func (e SyntaxError) String() string {
-       return string(e);
-}
+func (e SyntaxError) String() string   { return string(e) }
 
 var newline = []byte{'\n'}
 
@@ -318,6 +316,4 @@ func hasPrefix(s []byte, t string) bool {
 
 // splitLines returns the result of splitting s into lines.
 // The \n on each line is preserved.
-func splitLines(s []byte) [][]byte {
-       return bytes.SplitAfter(s, newline, 0);
-}
+func splitLines(s []byte) [][]byte     { return bytes.SplitAfter(s, newline, 0) }
index 9036cc1858ba1463f2ebca503b410cde8645c577..396d6db7de3a858266af572191222786f9f0de3f 100644 (file)
@@ -186,9 +186,7 @@ func makeTree(t *testing.T) {
        });
 }
 
-func markTree(n *Node) {
-       walkTree(n, "", func(path string, n *Node) { n.mark++ });
-}
+func markTree(n *Node) { walkTree(n, "", func(path string, n *Node) { n.mark++ }) }
 
 func checkMarks(t *testing.T) {
        walkTree(tree, tree.name, func(path string, n *Node) {
index 2e6aab88cd9990763bac3afdce1588a0e9c6fee5..65b14cd1816ca19621ddb8d3d627f3a1d4aa8c9d 100644 (file)
@@ -26,29 +26,19 @@ type Rand struct {
 
 // New returns a new Rand that uses random values from src
 // to generate other random values.
-func New(src Source) *Rand {
-       return &Rand{src};
-}
+func New(src Source) *Rand     { return &Rand{src} }
 
 // Seed uses the provided seed value to initialize the generator to a deterministic state.
-func (r *Rand) Seed(seed int64) {
-       r.src.Seed(seed);
-}
+func (r *Rand) Seed(seed int64)        { r.src.Seed(seed) }
 
 // Int63 returns a non-negative pseudo-random 63-bit integer as an int64.
-func (r *Rand) Int63() int64 {
-       return r.src.Int63();
-}
+func (r *Rand) Int63() int64   { return r.src.Int63() }
 
 // Uint32 returns a pseudo-random 32-bit value as a uint32.
-func (r *Rand) Uint32() uint32 {
-       return uint32(r.Int63() >> 31);
-}
+func (r *Rand) Uint32() uint32 { return uint32(r.Int63() >> 31) }
 
 // Int31 returns a non-negative pseudo-random 31-bit integer as an int32.
-func (r *Rand) Int31() int32 {
-       return int32(r.Int63() >> 32);
-}
+func (r *Rand) Int31() int32   { return int32(r.Int63() >> 32) }
 
 // Int returns a non-negative pseudo-random int.
 func (r *Rand) Int() int {
@@ -70,29 +60,19 @@ func (r *Rand) Int63n(n int64) int64 {
 }
 
 // Int31n returns, as an int32, a non-negative pseudo-random number in [0,n).
-func (r *Rand) Int31n(n int32) int32 {
-       return int32(r.Int63n(int64(n)));
-}
+func (r *Rand) Int31n(n int32) int32   { return int32(r.Int63n(int64(n))) }
 
 // Intn returns, as an int, a non-negative pseudo-random number in [0,n).
-func (r *Rand) Intn(n int) int {
-       return int(r.Int63n(int64(n)));
-}
+func (r *Rand) Intn(n int) int { return int(r.Int63n(int64(n))) }
 
 // Float64 returns, as a float64, a pseudo-random number in [0.0,1.0).
-func (r *Rand) Float64() float64 {
-       return float64(r.Int63())/(1<<63);
-}
+func (r *Rand) Float64() float64       { return float64(r.Int63())/(1<<63) }
 
 // Float32 returns, as a float32, a pseudo-random number in [0.0,1.0).
-func (r *Rand) Float32() float32 {
-       return float32(r.Float64());
-}
+func (r *Rand) Float32() float32       { return float32(r.Float64()) }
 
 // Float returns, as a float, a pseudo-random number in [0.0,1.0).
-func (r *Rand) Float() float {
-       return float(r.Float64());
-}
+func (r *Rand) Float() float   { return float(r.Float64()) }
 
 // Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n).
 func (r *Rand) Perm(n int) []int {
@@ -114,64 +94,40 @@ func (r *Rand) Perm(n int) []int {
 var globalRand = New(NewSource(1))
 
 // Seed uses the provided seed value to initialize the generator to a deterministic state.
-func Seed(seed int64) {
-       globalRand.Seed(seed);
-}
+func Seed(seed int64)  { globalRand.Seed(seed) }
 
 // Int63 returns a non-negative pseudo-random 63-bit integer as an int64.
-func Int63() int64 {
-       return globalRand.Int63();
-}
+func Int63() int64     { return globalRand.Int63() }
 
 // Uint32 returns a pseudo-random 32-bit value as a uint32.
-func Uint32() uint32 {
-       return globalRand.Uint32();
-}
+func Uint32() uint32   { return globalRand.Uint32() }
 
 // Int31 returns a non-negative pseudo-random 31-bit integer as an int32.
-func Int31() int32 {
-       return globalRand.Int31();
-}
+func Int31() int32     { return globalRand.Int31() }
 
 // Int returns a non-negative pseudo-random int.
-func Int() int {
-       return globalRand.Int();
-}
+func Int() int { return globalRand.Int() }
 
 // Int63n returns, as an int64, a non-negative pseudo-random number in [0,n).
-func Int63n(n int64) int64 {
-       return globalRand.Int63n(n);
-}
+func Int63n(n int64) int64     { return globalRand.Int63n(n) }
 
 // Int31n returns, as an int32, a non-negative pseudo-random number in [0,n).
-func Int31n(n int32) int32 {
-       return globalRand.Int31n(n);
-}
+func Int31n(n int32) int32     { return globalRand.Int31n(n) }
 
 // Intn returns, as an int, a non-negative pseudo-random number in [0,n).
-func Intn(n int) int {
-       return globalRand.Intn(n);
-}
+func Intn(n int) int   { return globalRand.Intn(n) }
 
 // Float64 returns, as a float64, a pseudo-random number in [0.0,1.0).
-func Float64() float64 {
-       return globalRand.Float64();
-}
+func Float64() float64 { return globalRand.Float64() }
 
 // Float32 returns, as a float32, a pseudo-random number in [0.0,1.0).
-func Float32() float32 {
-       return globalRand.Float32();
-}
+func Float32() float32 { return globalRand.Float32() }
 
 // Float returns, as a float, a pseudo-random number in [0.0,1.0).
-func Float() float {
-       return globalRand.Float();
-}
+func Float() float     { return globalRand.Float() }
 
 // Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n).
-func Perm(n int) []int {
-       return globalRand.Perm(n);
-}
+func Perm(n int) []int { return globalRand.Perm(n) }
 
 // NormFloat64 returns a normally distributed float64 in the range
 // [-math.MaxFloat64, +math.MaxFloat64] with
@@ -181,9 +137,7 @@ func Perm(n int) []int {
 //
 //  sample = NormFloat64() * desiredStdDev + desiredMean
 //
-func NormFloat64() float64 {
-       return globalRand.NormFloat64();
-}
+func NormFloat64() float64     { return globalRand.NormFloat64() }
 
 // ExpFloat64 returns an exponentially distributed float64 in the range
 // (0, +math.MaxFloat64] with an exponential distribution whose rate parameter
@@ -193,6 +147,4 @@ func NormFloat64() float64 {
 //
 //  sample = ExpFloat64() / desiredRateParameter
 //
-func ExpFloat64() float64 {
-       return globalRand.ExpFloat64();
-}
+func ExpFloat64() float64      { return globalRand.ExpFloat64() }
index 5ced275543d028c18d651ecd13b69b25ae4cb89d..abdf572097bbca7ece730ee8df67d83c896d0e6e 100644 (file)
@@ -25,9 +25,7 @@ type pair struct {
        s       string;
 }
 
-func isDigit(c uint8) bool {
-       return '0' <= c && c <= '9';
-}
+func isDigit(c uint8) bool     { return '0' <= c && c <= '9' }
 
 func assert(t *testing.T, s, want string) {
        if s != want {
@@ -35,9 +33,7 @@ func assert(t *testing.T, s, want string) {
        }
 }
 
-func typestring(i interface{}) string {
-       return Typeof(i).String();
-}
+func typestring(i interface{}) string  { return Typeof(i).String() }
 
 var typeTests = []pair{
        pair{struct {
@@ -1070,9 +1066,7 @@ type Point struct {
        x, y int;
 }
 
-func (p Point) Dist(scale int) int {
-       return p.x * p.x * scale + p.y * p.y * scale;
-}
+func (p Point) Dist(scale int) int     { return p.x * p.x * scale + p.y * p.y * scale }
 
 func TestMethod(t *testing.T) {
        // Non-curried method of type.
index b6a526eca07788832e8a94835175a73b5e5323ff..02eb549e8d2b6d3e31b4ddb311e27124c36fc431 100644 (file)
@@ -291,21 +291,13 @@ func (t *uncommonType) Name() string {
        return *t.name;
 }
 
-func (t *commonType) String() string {
-       return *t.string;
-}
+func (t *commonType) String() string   { return *t.string }
 
-func (t *commonType) Size() uintptr {
-       return t.size;
-}
+func (t *commonType) Size() uintptr    { return t.size }
 
-func (t *commonType) Align() int {
-       return int(t.align);
-}
+func (t *commonType) Align() int       { return int(t.align) }
 
-func (t *commonType) FieldAlign() int {
-       return int(t.fieldAlign);
-}
+func (t *commonType) FieldAlign() int  { return int(t.fieldAlign) }
 
 func (t *uncommonType) Method(i int) (m Method) {
        if t == nil || i < 0 || i >= len(t.methods) {
@@ -334,41 +326,25 @@ func (t *uncommonType) NumMethod() int {
 // TODO(rsc): 6g supplies these, but they are not
 // as efficient as they could be: they have commonType
 // as the receiver instead of *commonType.
-func (t *commonType) NumMethod() int {
-       return t.uncommonType.NumMethod();
-}
+func (t *commonType) NumMethod() int   { return t.uncommonType.NumMethod() }
 
-func (t *commonType) Method(i int) (m Method) {
-       return t.uncommonType.Method(i);
-}
+func (t *commonType) Method(i int) (m Method)  { return t.uncommonType.Method(i) }
 
-func (t *commonType) PkgPath() string {
-       return t.uncommonType.PkgPath();
-}
+func (t *commonType) PkgPath() string  { return t.uncommonType.PkgPath() }
 
-func (t *commonType) Name() string {
-       return t.uncommonType.Name();
-}
+func (t *commonType) Name() string     { return t.uncommonType.Name() }
 
 // Len returns the number of elements in the array.
-func (t *ArrayType) Len() int {
-       return int(t.len);
-}
+func (t *ArrayType) Len() int  { return int(t.len) }
 
 // Elem returns the type of the array's elements.
-func (t *ArrayType) Elem() Type {
-       return toType(*t.elem);
-}
+func (t *ArrayType) Elem() Type        { return toType(*t.elem) }
 
 // Dir returns the channel direction.
-func (t *ChanType) Dir() ChanDir {
-       return ChanDir(t.dir);
-}
+func (t *ChanType) Dir() ChanDir       { return ChanDir(t.dir) }
 
 // Elem returns the channel's element type.
-func (t *ChanType) Elem() Type {
-       return toType(*t.elem);
-}
+func (t *ChanType) Elem() Type { return toType(*t.elem) }
 
 func (d ChanDir) String() string {
        switch d {
@@ -391,9 +367,7 @@ func (t *FuncType) In(i int) Type {
 }
 
 // NumIn returns the number of input parameters.
-func (t *FuncType) NumIn() int {
-       return len(t.in);
-}
+func (t *FuncType) NumIn() int { return len(t.in) }
 
 // Out returns the type of the i'th function output parameter.
 func (t *FuncType) Out(i int) Type {
@@ -404,9 +378,7 @@ func (t *FuncType) Out(i int) Type {
 }
 
 // NumOut returns the number of function output parameters.
-func (t *FuncType) NumOut() int {
-       return len(t.out);
-}
+func (t *FuncType) NumOut() int        { return len(t.out) }
 
 // Method returns the i'th interface method.
 func (t *InterfaceType) Method(i int) (m Method) {
@@ -423,29 +395,19 @@ func (t *InterfaceType) Method(i int) (m Method) {
 }
 
 // NumMethod returns the number of interface methods.
-func (t *InterfaceType) NumMethod() int {
-       return len(t.methods);
-}
+func (t *InterfaceType) NumMethod() int        { return len(t.methods) }
 
 // Key returns the map key type.
-func (t *MapType) Key() Type {
-       return toType(*t.key);
-}
+func (t *MapType) Key() Type   { return toType(*t.key) }
 
 // Elem returns the map element type.
-func (t *MapType) Elem() Type {
-       return toType(*t.elem);
-}
+func (t *MapType) Elem() Type  { return toType(*t.elem) }
 
 // Elem returns the pointer element type.
-func (t *PtrType) Elem() Type {
-       return toType(*t.elem);
-}
+func (t *PtrType) Elem() Type  { return toType(*t.elem) }
 
 // Elem returns the type of the slice's elements.
-func (t *SliceType) Elem() Type {
-       return toType(*t.elem);
-}
+func (t *SliceType) Elem() Type        { return toType(*t.elem) }
 
 type StructField struct {
        PkgPath         string; // empty for uppercase Name
@@ -588,9 +550,7 @@ func (t *StructType) FieldByName(name string) (f StructField, present bool) {
 }
 
 // NumField returns the number of struct fields.
-func (t *StructType) NumField() int {
-       return len(t.fields);
-}
+func (t *StructType) NumField() int    { return len(t.fields) }
 
 // Convert runtime type to reflect type.
 // Same memory layouts, different method sets.
@@ -660,6 +620,4 @@ type ArrayOrSliceType interface {
 }
 
 // Typeof returns the reflection Type of the value in the interface{}.
-func Typeof(i interface{}) Type {
-       return toType(unsafe.Typeof(i));
-}
+func Typeof(i interface{}) Type        { return toType(unsafe.Typeof(i)) }
index f58f642778948c83790e645ba5ddeb62cbcc5b7a..453fe8a8f0c5491f9e04beefe7ee354e04dd9662 100644 (file)
@@ -80,17 +80,11 @@ type value struct {
        canSet  bool;
 }
 
-func (v *value) Type() Type {
-       return v.typ;
-}
+func (v *value) Type() Type    { return v.typ }
 
-func (v *value) Addr() uintptr {
-       return uintptr(v.addr);
-}
+func (v *value) Addr() uintptr { return uintptr(v.addr) }
 
-func (v *value) getAddr() addr {
-       return v.addr;
-}
+func (v *value) getAddr() addr { return v.addr }
 
 func (v *value) Interface() interface{} {
        if typ, ok := v.typ.(*InterfaceType); ok {
@@ -110,9 +104,7 @@ func (v *value) Interface() interface{} {
        return unsafe.Unreflect(v.typ, unsafe.Pointer(v.addr));
 }
 
-func (v *value) CanSet() bool {
-       return v.canSet;
-}
+func (v *value) CanSet() bool  { return v.canSet }
 
 /*
  * basic types
@@ -124,9 +116,7 @@ type BoolValue struct {
 }
 
 // Get returns the underlying bool value.
-func (v *BoolValue) Get() bool {
-       return *(*bool)(v.addr);
-}
+func (v *BoolValue) Get() bool { return *(*bool)(v.addr) }
 
 // Set sets v to the value x.
 func (v *BoolValue) Set(x bool) {
@@ -137,9 +127,7 @@ func (v *BoolValue) Set(x bool) {
 }
 
 // Set sets v to the value x.
-func (v *BoolValue) SetValue(x Value) {
-       v.Set(x.(*BoolValue).Get());
-}
+func (v *BoolValue) SetValue(x Value)  { v.Set(x.(*BoolValue).Get()) }
 
 // FloatValue represents a float value.
 type FloatValue struct {
@@ -147,9 +135,7 @@ type FloatValue struct {
 }
 
 // Get returns the underlying float value.
-func (v *FloatValue) Get() float {
-       return *(*float)(v.addr);
-}
+func (v *FloatValue) Get() float       { return *(*float)(v.addr) }
 
 // Set sets v to the value x.
 func (v *FloatValue) Set(x float) {
@@ -160,9 +146,7 @@ func (v *FloatValue) Set(x float) {
 }
 
 // Set sets v to the value x.
-func (v *FloatValue) SetValue(x Value) {
-       v.Set(x.(*FloatValue).Get());
-}
+func (v *FloatValue) SetValue(x Value) { v.Set(x.(*FloatValue).Get()) }
 
 // Float32Value represents a float32 value.
 type Float32Value struct {
@@ -170,9 +154,7 @@ type Float32Value struct {
 }
 
 // Get returns the underlying float32 value.
-func (v *Float32Value) Get() float32 {
-       return *(*float32)(v.addr);
-}
+func (v *Float32Value) Get() float32   { return *(*float32)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Float32Value) Set(x float32) {
@@ -183,9 +165,7 @@ func (v *Float32Value) Set(x float32) {
 }
 
 // Set sets v to the value x.
-func (v *Float32Value) SetValue(x Value) {
-       v.Set(x.(*Float32Value).Get());
-}
+func (v *Float32Value) SetValue(x Value)       { v.Set(x.(*Float32Value).Get()) }
 
 // Float64Value represents a float64 value.
 type Float64Value struct {
@@ -193,9 +173,7 @@ type Float64Value struct {
 }
 
 // Get returns the underlying float64 value.
-func (v *Float64Value) Get() float64 {
-       return *(*float64)(v.addr);
-}
+func (v *Float64Value) Get() float64   { return *(*float64)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Float64Value) Set(x float64) {
@@ -206,9 +184,7 @@ func (v *Float64Value) Set(x float64) {
 }
 
 // Set sets v to the value x.
-func (v *Float64Value) SetValue(x Value) {
-       v.Set(x.(*Float64Value).Get());
-}
+func (v *Float64Value) SetValue(x Value)       { v.Set(x.(*Float64Value).Get()) }
 
 // IntValue represents an int value.
 type IntValue struct {
@@ -216,9 +192,7 @@ type IntValue struct {
 }
 
 // Get returns the underlying int value.
-func (v *IntValue) Get() int {
-       return *(*int)(v.addr);
-}
+func (v *IntValue) Get() int   { return *(*int)(v.addr) }
 
 // Set sets v to the value x.
 func (v *IntValue) Set(x int) {
@@ -229,9 +203,7 @@ func (v *IntValue) Set(x int) {
 }
 
 // Set sets v to the value x.
-func (v *IntValue) SetValue(x Value) {
-       v.Set(x.(*IntValue).Get());
-}
+func (v *IntValue) SetValue(x Value)   { v.Set(x.(*IntValue).Get()) }
 
 // Int8Value represents an int8 value.
 type Int8Value struct {
@@ -239,9 +211,7 @@ type Int8Value struct {
 }
 
 // Get returns the underlying int8 value.
-func (v *Int8Value) Get() int8 {
-       return *(*int8)(v.addr);
-}
+func (v *Int8Value) Get() int8 { return *(*int8)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Int8Value) Set(x int8) {
@@ -252,9 +222,7 @@ func (v *Int8Value) Set(x int8) {
 }
 
 // Set sets v to the value x.
-func (v *Int8Value) SetValue(x Value) {
-       v.Set(x.(*Int8Value).Get());
-}
+func (v *Int8Value) SetValue(x Value)  { v.Set(x.(*Int8Value).Get()) }
 
 // Int16Value represents an int16 value.
 type Int16Value struct {
@@ -262,9 +230,7 @@ type Int16Value struct {
 }
 
 // Get returns the underlying int16 value.
-func (v *Int16Value) Get() int16 {
-       return *(*int16)(v.addr);
-}
+func (v *Int16Value) Get() int16       { return *(*int16)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Int16Value) Set(x int16) {
@@ -275,9 +241,7 @@ func (v *Int16Value) Set(x int16) {
 }
 
 // Set sets v to the value x.
-func (v *Int16Value) SetValue(x Value) {
-       v.Set(x.(*Int16Value).Get());
-}
+func (v *Int16Value) SetValue(x Value) { v.Set(x.(*Int16Value).Get()) }
 
 // Int32Value represents an int32 value.
 type Int32Value struct {
@@ -285,9 +249,7 @@ type Int32Value struct {
 }
 
 // Get returns the underlying int32 value.
-func (v *Int32Value) Get() int32 {
-       return *(*int32)(v.addr);
-}
+func (v *Int32Value) Get() int32       { return *(*int32)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Int32Value) Set(x int32) {
@@ -298,9 +260,7 @@ func (v *Int32Value) Set(x int32) {
 }
 
 // Set sets v to the value x.
-func (v *Int32Value) SetValue(x Value) {
-       v.Set(x.(*Int32Value).Get());
-}
+func (v *Int32Value) SetValue(x Value) { v.Set(x.(*Int32Value).Get()) }
 
 // Int64Value represents an int64 value.
 type Int64Value struct {
@@ -308,9 +268,7 @@ type Int64Value struct {
 }
 
 // Get returns the underlying int64 value.
-func (v *Int64Value) Get() int64 {
-       return *(*int64)(v.addr);
-}
+func (v *Int64Value) Get() int64       { return *(*int64)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Int64Value) Set(x int64) {
@@ -321,9 +279,7 @@ func (v *Int64Value) Set(x int64) {
 }
 
 // Set sets v to the value x.
-func (v *Int64Value) SetValue(x Value) {
-       v.Set(x.(*Int64Value).Get());
-}
+func (v *Int64Value) SetValue(x Value) { v.Set(x.(*Int64Value).Get()) }
 
 // StringValue represents a string value.
 type StringValue struct {
@@ -331,9 +287,7 @@ type StringValue struct {
 }
 
 // Get returns the underlying string value.
-func (v *StringValue) Get() string {
-       return *(*string)(v.addr);
-}
+func (v *StringValue) Get() string     { return *(*string)(v.addr) }
 
 // Set sets v to the value x.
 func (v *StringValue) Set(x string) {
@@ -344,9 +298,7 @@ func (v *StringValue) Set(x string) {
 }
 
 // Set sets v to the value x.
-func (v *StringValue) SetValue(x Value) {
-       v.Set(x.(*StringValue).Get());
-}
+func (v *StringValue) SetValue(x Value)        { v.Set(x.(*StringValue).Get()) }
 
 // UintValue represents a uint value.
 type UintValue struct {
@@ -354,9 +306,7 @@ type UintValue struct {
 }
 
 // Get returns the underlying uint value.
-func (v *UintValue) Get() uint {
-       return *(*uint)(v.addr);
-}
+func (v *UintValue) Get() uint { return *(*uint)(v.addr) }
 
 // Set sets v to the value x.
 func (v *UintValue) Set(x uint) {
@@ -367,9 +317,7 @@ func (v *UintValue) Set(x uint) {
 }
 
 // Set sets v to the value x.
-func (v *UintValue) SetValue(x Value) {
-       v.Set(x.(*UintValue).Get());
-}
+func (v *UintValue) SetValue(x Value)  { v.Set(x.(*UintValue).Get()) }
 
 // Uint8Value represents a uint8 value.
 type Uint8Value struct {
@@ -377,9 +325,7 @@ type Uint8Value struct {
 }
 
 // Get returns the underlying uint8 value.
-func (v *Uint8Value) Get() uint8 {
-       return *(*uint8)(v.addr);
-}
+func (v *Uint8Value) Get() uint8       { return *(*uint8)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Uint8Value) Set(x uint8) {
@@ -390,9 +336,7 @@ func (v *Uint8Value) Set(x uint8) {
 }
 
 // Set sets v to the value x.
-func (v *Uint8Value) SetValue(x Value) {
-       v.Set(x.(*Uint8Value).Get());
-}
+func (v *Uint8Value) SetValue(x Value) { v.Set(x.(*Uint8Value).Get()) }
 
 // Uint16Value represents a uint16 value.
 type Uint16Value struct {
@@ -400,9 +344,7 @@ type Uint16Value struct {
 }
 
 // Get returns the underlying uint16 value.
-func (v *Uint16Value) Get() uint16 {
-       return *(*uint16)(v.addr);
-}
+func (v *Uint16Value) Get() uint16     { return *(*uint16)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Uint16Value) Set(x uint16) {
@@ -413,9 +355,7 @@ func (v *Uint16Value) Set(x uint16) {
 }
 
 // Set sets v to the value x.
-func (v *Uint16Value) SetValue(x Value) {
-       v.Set(x.(*Uint16Value).Get());
-}
+func (v *Uint16Value) SetValue(x Value)        { v.Set(x.(*Uint16Value).Get()) }
 
 // Uint32Value represents a uint32 value.
 type Uint32Value struct {
@@ -423,9 +363,7 @@ type Uint32Value struct {
 }
 
 // Get returns the underlying uint32 value.
-func (v *Uint32Value) Get() uint32 {
-       return *(*uint32)(v.addr);
-}
+func (v *Uint32Value) Get() uint32     { return *(*uint32)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Uint32Value) Set(x uint32) {
@@ -436,9 +374,7 @@ func (v *Uint32Value) Set(x uint32) {
 }
 
 // Set sets v to the value x.
-func (v *Uint32Value) SetValue(x Value) {
-       v.Set(x.(*Uint32Value).Get());
-}
+func (v *Uint32Value) SetValue(x Value)        { v.Set(x.(*Uint32Value).Get()) }
 
 // Uint64Value represents a uint64 value.
 type Uint64Value struct {
@@ -446,9 +382,7 @@ type Uint64Value struct {
 }
 
 // Get returns the underlying uint64 value.
-func (v *Uint64Value) Get() uint64 {
-       return *(*uint64)(v.addr);
-}
+func (v *Uint64Value) Get() uint64     { return *(*uint64)(v.addr) }
 
 // Set sets v to the value x.
 func (v *Uint64Value) Set(x uint64) {
@@ -459,9 +393,7 @@ func (v *Uint64Value) Set(x uint64) {
 }
 
 // Set sets v to the value x.
-func (v *Uint64Value) SetValue(x Value) {
-       v.Set(x.(*Uint64Value).Get());
-}
+func (v *Uint64Value) SetValue(x Value)        { v.Set(x.(*Uint64Value).Get()) }
 
 // UintptrValue represents a uintptr value.
 type UintptrValue struct {
@@ -469,9 +401,7 @@ type UintptrValue struct {
 }
 
 // Get returns the underlying uintptr value.
-func (v *UintptrValue) Get() uintptr {
-       return *(*uintptr)(v.addr);
-}
+func (v *UintptrValue) Get() uintptr   { return *(*uintptr)(v.addr) }
 
 // Set sets v to the value x.
 func (v *UintptrValue) Set(x uintptr) {
@@ -482,9 +412,7 @@ func (v *UintptrValue) Set(x uintptr) {
 }
 
 // Set sets v to the value x.
-func (v *UintptrValue) SetValue(x Value) {
-       v.Set(x.(*UintptrValue).Get());
-}
+func (v *UintptrValue) SetValue(x Value)       { v.Set(x.(*UintptrValue).Get()) }
 
 // UnsafePointerValue represents an unsafe.Pointer value.
 type UnsafePointerValue struct {
@@ -495,9 +423,7 @@ type UnsafePointerValue struct {
 // Get returns uintptr, not unsafe.Pointer, so that
 // programs that do not import "unsafe" cannot
 // obtain a value of unsafe.Pointer type from "reflect".
-func (v *UnsafePointerValue) Get() uintptr {
-       return uintptr(*(*unsafe.Pointer)(v.addr));
-}
+func (v *UnsafePointerValue) Get() uintptr     { return uintptr(*(*unsafe.Pointer)(v.addr)) }
 
 // Set sets v to the value x.
 func (v *UnsafePointerValue) Set(x unsafe.Pointer) {
@@ -556,19 +482,13 @@ type ArrayValue struct {
 }
 
 // Len returns the length of the array.
-func (v *ArrayValue) Len() int {
-       return v.typ.(*ArrayType).Len();
-}
+func (v *ArrayValue) Len() int { return v.typ.(*ArrayType).Len() }
 
 // Cap returns the capacity of the array (equal to Len()).
-func (v *ArrayValue) Cap() int {
-       return v.typ.(*ArrayType).Len();
-}
+func (v *ArrayValue) Cap() int { return v.typ.(*ArrayType).Len() }
 
 // addr returns the base address of the data in the array.
-func (v *ArrayValue) addr() addr {
-       return v.value.addr;
-}
+func (v *ArrayValue) addr() addr       { return v.value.addr }
 
 // Set assigns x to v.
 // The new value x must have the same type as v.
@@ -581,9 +501,7 @@ func (v *ArrayValue) Set(x *ArrayValue) {
 }
 
 // Set sets v to the value x.
-func (v *ArrayValue) SetValue(x Value) {
-       v.Set(x.(*ArrayValue));
-}
+func (v *ArrayValue) SetValue(x Value) { v.Set(x.(*ArrayValue)) }
 
 // Elem returns the i'th element of v.
 func (v *ArrayValue) Elem(i int) Value {
@@ -612,29 +530,19 @@ type SliceValue struct {
        value;
 }
 
-func (v *SliceValue) slice() *SliceHeader {
-       return (*SliceHeader)(v.value.addr);
-}
+func (v *SliceValue) slice() *SliceHeader      { return (*SliceHeader)(v.value.addr) }
 
 // IsNil returns whether v is a nil slice.
-func (v *SliceValue) IsNil() bool {
-       return v.slice().Data == 0;
-}
+func (v *SliceValue) IsNil() bool      { return v.slice().Data == 0 }
 
 // Len returns the length of the slice.
-func (v *SliceValue) Len() int {
-       return int(v.slice().Len);
-}
+func (v *SliceValue) Len() int { return int(v.slice().Len) }
 
 // Cap returns the capacity of the slice.
-func (v *SliceValue) Cap() int {
-       return int(v.slice().Cap);
-}
+func (v *SliceValue) Cap() int { return int(v.slice().Cap) }
 
 // addr returns the base address of the data in the slice.
-func (v *SliceValue) addr() addr {
-       return addr(v.slice().Data);
-}
+func (v *SliceValue) addr() addr       { return addr(v.slice().Data) }
 
 // SetLen changes the length of v.
 // The new length n must be between 0 and the capacity, inclusive.
@@ -657,9 +565,7 @@ func (v *SliceValue) Set(x *SliceValue) {
 }
 
 // Set sets v to the value x.
-func (v *SliceValue) SetValue(x Value) {
-       v.Set(x.(*SliceValue));
-}
+func (v *SliceValue) SetValue(x Value) { v.Set(x.(*SliceValue)) }
 
 // Slice returns a sub-slice of the slice v.
 func (v *SliceValue) Slice(beg, end int) *SliceValue {
@@ -711,9 +617,7 @@ type ChanValue struct {
 }
 
 // IsNil returns whether v is a nil channel.
-func (v *ChanValue) IsNil() bool {
-       return *(*uintptr)(v.addr) == 0;
-}
+func (v *ChanValue) IsNil() bool       { return *(*uintptr)(v.addr) == 0 }
 
 // Set assigns x to v.
 // The new value x must have the same type as v.
@@ -726,15 +630,11 @@ func (v *ChanValue) Set(x *ChanValue) {
 }
 
 // Set sets v to the value x.
-func (v *ChanValue) SetValue(x Value) {
-       v.Set(x.(*ChanValue));
-}
+func (v *ChanValue) SetValue(x Value)  { v.Set(x.(*ChanValue)) }
 
 // Get returns the uintptr value of v.
 // It is mainly useful for printing.
-func (v *ChanValue) Get() uintptr {
-       return *(*uintptr)(v.addr);
-}
+func (v *ChanValue) Get() uintptr      { return *(*uintptr)(v.addr) }
 
 // implemented in ../pkg/runtime/reflect.cgo
 func makechan(typ *runtime.ChanType, size uint32) (ch *byte)
@@ -791,14 +691,10 @@ func (v *ChanValue) recv(b *bool) Value {
 }
 
 // Send sends x on the channel v.
-func (v *ChanValue) Send(x Value) {
-       v.send(x, nil);
-}
+func (v *ChanValue) Send(x Value)      { v.send(x, nil) }
 
 // Recv receives and returns a value from the channel v.
-func (v *ChanValue) Recv() Value {
-       return v.recv(nil);
-}
+func (v *ChanValue) Recv() Value       { return v.recv(nil) }
 
 // TrySend attempts to sends x on the channel v but will not block.
 // It returns true if the value was sent, false otherwise.
@@ -844,15 +740,11 @@ type FuncValue struct {
 }
 
 // IsNil returns whether v is a nil function.
-func (v *FuncValue) IsNil() bool {
-       return *(*uintptr)(v.addr) == 0;
-}
+func (v *FuncValue) IsNil() bool       { return *(*uintptr)(v.addr) == 0 }
 
 // Get returns the uintptr value of v.
 // It is mainly useful for printing.
-func (v *FuncValue) Get() uintptr {
-       return *(*uintptr)(v.addr);
-}
+func (v *FuncValue) Get() uintptr      { return *(*uintptr)(v.addr) }
 
 // Set assigns x to v.
 // The new value x must have the same type as v.
@@ -865,9 +757,7 @@ func (v *FuncValue) Set(x *FuncValue) {
 }
 
 // Set sets v to the value x.
-func (v *FuncValue) SetValue(x Value) {
-       v.Set(x.(*FuncValue));
-}
+func (v *FuncValue) SetValue(x Value)  { v.Set(x.(*FuncValue)) }
 
 // Method returns a FuncValue corresponding to v's i'th method.
 // The arguments to a Call on the returned FuncValue
@@ -1006,14 +896,10 @@ type InterfaceValue struct {
 // No Get because v.Interface() is available.
 
 // IsNil returns whether v is a nil interface value.
-func (v *InterfaceValue) IsNil() bool {
-       return v.Interface() == nil;
-}
+func (v *InterfaceValue) IsNil() bool  { return v.Interface() == nil }
 
 // Elem returns the concrete value stored in the interface value v.
-func (v *InterfaceValue) Elem() Value {
-       return NewValue(v.Interface());
-}
+func (v *InterfaceValue) Elem() Value  { return NewValue(v.Interface()) }
 
 // ../runtime/reflect.cgo
 func setiface(typ *InterfaceType, x *interface{}, addr addr)
@@ -1037,9 +923,7 @@ func (v *InterfaceValue) Set(x Value) {
 }
 
 // Set sets v to the value x.
-func (v *InterfaceValue) SetValue(x Value) {
-       v.Set(x);
-}
+func (v *InterfaceValue) SetValue(x Value)     { v.Set(x) }
 
 // Method returns a FuncValue corresponding to v's i'th method.
 // The arguments to a Call on the returned FuncValue
@@ -1072,9 +956,7 @@ type MapValue struct {
 }
 
 // IsNil returns whether v is a nil map value.
-func (v *MapValue) IsNil() bool {
-       return *(*uintptr)(v.addr) == 0;
-}
+func (v *MapValue) IsNil() bool        { return *(*uintptr)(v.addr) == 0 }
 
 // Set assigns x to v.
 // The new value x must have the same type as v.
@@ -1087,9 +969,7 @@ func (v *MapValue) Set(x *MapValue) {
 }
 
 // Set sets v to the value x.
-func (v *MapValue) SetValue(x Value) {
-       v.Set(x.(*MapValue));
-}
+func (v *MapValue) SetValue(x Value)   { v.Set(x.(*MapValue)) }
 
 // implemented in ../pkg/runtime/reflect.cgo
 func mapaccess(m, key, val *byte) bool
@@ -1179,15 +1059,11 @@ type PtrValue struct {
 }
 
 // IsNil returns whether v is a nil pointer.
-func (v *PtrValue) IsNil() bool {
-       return *(*uintptr)(v.addr) == 0;
-}
+func (v *PtrValue) IsNil() bool        { return *(*uintptr)(v.addr) == 0 }
 
 // Get returns the uintptr value of v.
 // It is mainly useful for printing.
-func (v *PtrValue) Get() uintptr {
-       return *(*uintptr)(v.addr);
-}
+func (v *PtrValue) Get() uintptr       { return *(*uintptr)(v.addr) }
 
 // Set assigns x to v.
 // The new value x must have the same type as v.
@@ -1202,9 +1078,7 @@ func (v *PtrValue) Set(x *PtrValue) {
 }
 
 // Set sets v to the value x.
-func (v *PtrValue) SetValue(x Value) {
-       v.Set(x.(*PtrValue));
-}
+func (v *PtrValue) SetValue(x Value)   { v.Set(x.(*PtrValue)) }
 
 // PointTo changes v to point to x.
 func (v *PtrValue) PointTo(x Value) {
@@ -1258,9 +1132,7 @@ func (v *StructValue) Set(x *StructValue) {
 }
 
 // Set sets v to the value x.
-func (v *StructValue) SetValue(x Value) {
-       v.Set(x.(*StructValue));
-}
+func (v *StructValue) SetValue(x Value)        { v.Set(x.(*StructValue)) }
 
 // Field returns the i'th field of the struct.
 func (v *StructValue) Field(i int) Value {
@@ -1302,9 +1174,7 @@ func (t *StructValue) FieldByName(name string) Value {
 }
 
 // NumField returns the number of fields in the struct.
-func (v *StructValue) NumField() int {
-       return v.typ.(*StructType).NumField();
-}
+func (v *StructValue) NumField() int   { return v.typ.(*StructType).NumField() }
 
 /*
  * constructors
index 27fb8ef5d81626e99f90f51938f326f0727c931f..24fd597f773acb2a341066898eaf22d03d56c876 100644 (file)
@@ -62,18 +62,10 @@ type common struct {
        _index  int;
 }
 
-func (c *common) next() instr {
-       return c._next;
-}
-func (c *common) setNext(i instr) {
-       c._next = i;
-}
-func (c *common) index() int {
-       return c._index;
-}
-func (c *common) setIndex(i int) {
-       c._index = i;
-}
+func (c *common) next() instr          { return c._next }
+func (c *common) setNext(i instr)      { c._next = i }
+func (c *common) index() int           { return c._index }
+func (c *common) setIndex(i int)       { c._index = i }
 
 // Regexp is the representation of a compiled regular expression.
 // The public interface is entirely through methods.
@@ -104,48 +96,32 @@ type _Start struct {
        common;
 }
 
-func (start *_Start) kind() int {
-       return _START;
-}
-func (start *_Start) print() {
-       print("start");
-}
+func (start *_Start) kind() int        { return _START }
+func (start *_Start) print()   { print("start") }
 
 // --- END end of program
 type _End struct {
        common;
 }
 
-func (end *_End) kind() int {
-       return _END;
-}
-func (end *_End) print() {
-       print("end");
-}
+func (end *_End) kind() int    { return _END }
+func (end *_End) print()       { print("end") }
 
 // --- BOT beginning of text
 type _Bot struct {
        common;
 }
 
-func (bot *_Bot) kind() int {
-       return _BOT;
-}
-func (bot *_Bot) print() {
-       print("bot");
-}
+func (bot *_Bot) kind() int    { return _BOT }
+func (bot *_Bot) print()       { print("bot") }
 
 // --- EOT end of text
 type _Eot struct {
        common;
 }
 
-func (eot *_Eot) kind() int {
-       return _EOT;
-}
-func (eot *_Eot) print() {
-       print("eot");
-}
+func (eot *_Eot) kind() int    { return _EOT }
+func (eot *_Eot) print()       { print("eot") }
 
 // --- CHAR a regular character
 type _Char struct {
@@ -153,12 +129,8 @@ type _Char struct {
        char    int;
 }
 
-func (char *_Char) kind() int {
-       return _CHAR;
-}
-func (char *_Char) print() {
-       print("char ", string(char.char));
-}
+func (char *_Char) kind() int  { return _CHAR }
+func (char *_Char) print()     { print("char ", string(char.char)) }
 
 func newChar(char int) *_Char {
        c := new(_Char);
@@ -176,9 +148,7 @@ type _CharClass struct {
        ranges  *vector.IntVector;
 }
 
-func (cclass *_CharClass) kind() int {
-       return _CHARCLASS;
-}
+func (cclass *_CharClass) kind() int   { return _CHARCLASS }
 
 func (cclass *_CharClass) print() {
        print("charclass");
@@ -224,24 +194,16 @@ type _Any struct {
        common;
 }
 
-func (any *_Any) kind() int {
-       return _ANY;
-}
-func (any *_Any) print() {
-       print("any");
-}
+func (any *_Any) kind() int    { return _ANY }
+func (any *_Any) print()       { print("any") }
 
 // --- NOTNL any character but newline
 type _NotNl struct {
        common;
 }
 
-func (notnl *_NotNl) kind() int {
-       return _NOTNL;
-}
-func (notnl *_NotNl) print() {
-       print("notnl");
-}
+func (notnl *_NotNl) kind() int        { return _NOTNL }
+func (notnl *_NotNl) print()   { print("notnl") }
 
 // --- BRA parenthesized expression
 type _Bra struct {
@@ -249,12 +211,8 @@ type _Bra struct {
        n       int;    // subexpression number
 }
 
-func (bra *_Bra) kind() int {
-       return _BRA;
-}
-func (bra *_Bra) print() {
-       print("bra", bra.n);
-}
+func (bra *_Bra) kind() int    { return _BRA }
+func (bra *_Bra) print()       { print("bra", bra.n) }
 
 // --- EBRA end of parenthesized expression
 type _Ebra struct {
@@ -262,12 +220,8 @@ type _Ebra struct {
        n       int;    // subexpression number
 }
 
-func (ebra *_Ebra) kind() int {
-       return _EBRA;
-}
-func (ebra *_Ebra) print() {
-       print("ebra ", ebra.n);
-}
+func (ebra *_Ebra) kind() int  { return _EBRA }
+func (ebra *_Ebra) print()     { print("ebra ", ebra.n) }
 
 // --- ALT alternation
 type _Alt struct {
@@ -275,24 +229,16 @@ type _Alt struct {
        left    instr;  // other branch
 }
 
-func (alt *_Alt) kind() int {
-       return _ALT;
-}
-func (alt *_Alt) print() {
-       print("alt(", alt.left.index(), ")");
-}
+func (alt *_Alt) kind() int    { return _ALT }
+func (alt *_Alt) print()       { print("alt(", alt.left.index(), ")") }
 
 // --- NOP no operation
 type _Nop struct {
        common;
 }
 
-func (nop *_Nop) kind() int {
-       return _NOP;
-}
-func (nop *_Nop) print() {
-       print("nop");
-}
+func (nop *_Nop) kind() int    { return _NOP }
+func (nop *_Nop) print()       { print("nop") }
 
 func (re *Regexp) add(i instr) instr {
        i.setIndex(re.inst.Len());
@@ -310,9 +256,7 @@ type parser struct {
 
 const endOfFile = -1
 
-func (p *parser) c() int {
-       return p.ch;
-}
+func (p *parser) c() int       { return p.ch }
 
 func (p *parser) nextc() int {
        if p.pos >= len(p.re.expr) {
@@ -840,23 +784,17 @@ func (re *Regexp) ExecuteString(s string) (a []int) {
 //    b[a[2*i]:a[2*i+1]] for i > 0 is the subslice matched by the ith parenthesized subexpression.
 // A negative value means the subexpression did not match any element of the slice.
 // An empty array means "no match".
-func (re *Regexp) Execute(b []byte) (a []int) {
-       return re.doExecute("", b, 0);
-}
+func (re *Regexp) Execute(b []byte) (a []int)  { return re.doExecute("", b, 0) }
 
 
 // MatchString returns whether the Regexp matches the string s.
 // The return value is a boolean: true for match, false for no match.
-func (re *Regexp) MatchString(s string) bool {
-       return len(re.doExecute(s, nil, 0)) > 0;
-}
+func (re *Regexp) MatchString(s string) bool   { return len(re.doExecute(s, nil, 0)) > 0 }
 
 
 // Match returns whether the Regexp matches the byte slice b.
 // The return value is a boolean: true for match, false for no match.
-func (re *Regexp) Match(b []byte) bool {
-       return len(re.doExecute("", b, 0)) > 0;
-}
+func (re *Regexp) Match(b []byte) bool { return len(re.doExecute("", b, 0)) > 0 }
 
 
 // MatchStrings matches the Regexp against the string s.
index fd6acf584b7a382d25731f2355f062453aeaf8c1..425b7e6e438ed5ca2335a035837d31345f5112d7 100644 (file)
@@ -53,25 +53,13 @@ type debugService struct {
 
 type serviceArray []debugService
 
-func (s serviceArray) Len() int {
-       return len(s);
-}
-func (s serviceArray) Less(i, j int) bool {
-       return s[i].name < s[j].name;
-}
-func (s serviceArray) Swap(i, j int) {
-       s[i], s[j] = s[j], s[i];
-}
+func (s serviceArray) Len() int                        { return len(s) }
+func (s serviceArray) Less(i, j int) bool      { return s[i].name < s[j].name }
+func (s serviceArray) Swap(i, j int)           { s[i], s[j] = s[j], s[i] }
 
-func (m methodArray) Len() int {
-       return len(m);
-}
-func (m methodArray) Less(i, j int) bool {
-       return m[i].name < m[j].name;
-}
-func (m methodArray) Swap(i, j int) {
-       m[i], m[j] = m[j], m[i];
-}
+func (m methodArray) Len() int                 { return len(m) }
+func (m methodArray) Less(i, j int) bool       { return m[i].name < m[j].name }
+func (m methodArray) Swap(i, j int)            { m[i], m[j] = m[j], m[i] }
 
 // Runs at /debug/rpc
 func debugHTTP(c *http.Conn, req *http.Request) {
index c0fd9373b06c6ff0111910fb30b818eec4f60f88..3403c74bcd291ec787b8f3b2274eacef26282b8a 100644 (file)
@@ -370,23 +370,17 @@ func (server *serverType) accept(lis net.Listener) {
 //     - one return value of type os.Error
 // It returns an error if the receiver is not public or has no
 // suitable methods.
-func Register(rcvr interface{}) os.Error {
-       return server.register(rcvr);
-}
+func Register(rcvr interface{}) os.Error       { return server.register(rcvr) }
 
 // ServeConn runs the server on a single connection.  When the connection
 // completes, service terminates.  ServeConn blocks; the caller typically
 // invokes it in a go statement.
-func ServeConn(conn io.ReadWriteCloser) {
-       go server.input(conn);
-}
+func ServeConn(conn io.ReadWriteCloser)        { go server.input(conn) }
 
 // Accept accepts connections on the listener and serves requests
 // for each incoming connection.  Accept blocks; the caller typically
 // invokes it in a go statement.
-func Accept(lis net.Listener) {
-       server.accept(lis);
-}
+func Accept(lis net.Listener)  { server.accept(lis) }
 
 // Can connect to RPC service using HTTP CONNECT to rpcPath.
 var rpcPath string = "/_goRPC_"
index ce7408b90c584d3aeeefbc729f0f89f61a96c7d3..34a2c4346bf687d4858439403b9956c0594cd7f3 100644 (file)
@@ -131,9 +131,7 @@ func quickSort(data Interface, a, b int) {
        }
 }
 
-func Sort(data Interface) {
-       quickSort(data, 0, data.Len());
-}
+func Sort(data Interface)      { quickSort(data, 0, data.Len()) }
 
 
 func IsSorted(data Interface) bool {
@@ -152,85 +150,49 @@ func IsSorted(data Interface) bool {
 // IntArray attaches the methods of Interface to []int, sorting in increasing order.
 type IntArray []int
 
-func (p IntArray) Len() int {
-       return len(p);
-}
-func (p IntArray) Less(i, j int) bool {
-       return p[i] < p[j];
-}
-func (p IntArray) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
+func (p IntArray) Len() int            { return len(p) }
+func (p IntArray) Less(i, j int) bool  { return p[i] < p[j] }
+func (p IntArray) Swap(i, j int)       { p[i], p[j] = p[j], p[i] }
 
 // Sort is a convenience method.
-func (p IntArray) Sort() {
-       Sort(p);
-}
+func (p IntArray) Sort()       { Sort(p) }
 
 
 // FloatArray attaches the methods of Interface to []float, sorting in increasing order.
 type FloatArray []float
 
-func (p FloatArray) Len() int {
-       return len(p);
-}
-func (p FloatArray) Less(i, j int) bool {
-       return p[i] < p[j];
-}
-func (p FloatArray) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
+func (p FloatArray) Len() int          { return len(p) }
+func (p FloatArray) Less(i, j int) bool        { return p[i] < p[j] }
+func (p FloatArray) Swap(i, j int)     { p[i], p[j] = p[j], p[i] }
 
 // Sort is a convenience method.
-func (p FloatArray) Sort() {
-       Sort(p);
-}
+func (p FloatArray) Sort()     { Sort(p) }
 
 
 // StringArray attaches the methods of Interface to []string, sorting in increasing order.
 type StringArray []string
 
-func (p StringArray) Len() int {
-       return len(p);
-}
-func (p StringArray) Less(i, j int) bool {
-       return p[i] < p[j];
-}
-func (p StringArray) Swap(i, j int) {
-       p[i], p[j] = p[j], p[i];
-}
+func (p StringArray) Len() int                 { return len(p) }
+func (p StringArray) Less(i, j int) bool       { return p[i] < p[j] }
+func (p StringArray) Swap(i, j int)            { p[i], p[j] = p[j], p[i] }
 
 // Sort is a convenience method.
-func (p StringArray) Sort() {
-       Sort(p);
-}
+func (p StringArray) Sort()    { Sort(p) }
 
 
 // Convenience wrappers for common cases
 
 // SortInts sorts an array of ints in increasing order.
-func SortInts(a []int) {
-       Sort(IntArray(a));
-}
+func SortInts(a []int) { Sort(IntArray(a)) }
 // SortFloats sorts an array of floats in increasing order.
-func SortFloats(a []float) {
-       Sort(FloatArray(a));
-}
+func SortFloats(a []float)     { Sort(FloatArray(a)) }
 // SortStrings sorts an array of strings in increasing order.
-func SortStrings(a []string) {
-       Sort(StringArray(a));
-}
+func SortStrings(a []string)   { Sort(StringArray(a)) }
 
 
 // IntsAreSorted tests whether an array of ints is sorted in increasing order.
-func IntsAreSorted(a []int) bool {
-       return IsSorted(IntArray(a));
-}
+func IntsAreSorted(a []int) bool       { return IsSorted(IntArray(a)) }
 // FloatsAreSorted tests whether an array of floats is sorted in increasing order.
-func FloatsAreSorted(a []float) bool {
-       return IsSorted(FloatArray(a));
-}
+func FloatsAreSorted(a []float) bool   { return IsSorted(FloatArray(a)) }
 // StringsAreSorted tests whether an array of strings is sorted in increasing order.
-func StringsAreSorted(a []string) bool {
-       return IsSorted(StringArray(a));
-}
+func StringsAreSorted(a []string) bool { return IsSorted(StringArray(a)) }
index 5c52c0f2bbbab4b05647397978956483f1790a7b..623100006c0d7fd82d1bc55fffe6a38e64543bf8 100644 (file)
@@ -113,12 +113,8 @@ type testingData struct {
        nswap   int;
 }
 
-func (d *testingData) Len() int {
-       return len(d.data);
-}
-func (d *testingData) Less(i, j int) bool {
-       return d.data[i] < d.data[j];
-}
+func (d *testingData) Len() int                        { return len(d.data) }
+func (d *testingData) Less(i, j int) bool      { return d.data[i] < d.data[j] }
 func (d *testingData) Swap(i, j int) {
        if d.nswap >= d.maxswap {
                d.t.Errorf("%s: used %d swaps sorting array of %d", d.desc, d.nswap, len(d.data));
index f918650f3cacc236c0b5e983d010b74c047ea2d1..a59fb78b408e7c494d60a84f3e3ca1618cd053fa 100644 (file)
@@ -135,10 +135,6 @@ func testAtof(t *testing.T, opt bool) {
        SetOptimize(oldopt);
 }
 
-func TestAtof(t *testing.T) {
-       testAtof(t, true);
-}
+func TestAtof(t *testing.T)    { testAtof(t, true) }
 
-func TestAtofSlow(t *testing.T) {
-       testAtof(t, false);
-}
+func TestAtofSlow(t *testing.T)        { testAtof(t, false) }
index 2f1d5dec64decc695fae32ec2ea447933f0e2463..eddda20a5f2aff66153666f080e35c309d249077 100644 (file)
@@ -11,9 +11,7 @@ type NumError struct {
        Error   os.Error;
 }
 
-func (e *NumError) String() string {
-       return "parsing " + e.Num + ": " + e.Error.String();
-}
+func (e *NumError) String() string     { return "parsing " + e.Num + ": " + e.Error.String() }
 
 
 func computeIntsize() uint {
@@ -170,9 +168,7 @@ func Btoi64(s string, base int) (i int64, err os.Error) {
 
 // Atoi64 is like Atoui64 but allows signed numbers and
 // returns its result in an int64.
-func Atoi64(s string) (i int64, err os.Error) {
-       return Btoi64(s, 10);
-}
+func Atoi64(s string) (i int64, err os.Error)  { return Btoi64(s, 10) }
 
 
 // Atoui is like Atoui64 but returns its result as a uint.
index 7262b25a64026db066c4efb23765dc1e8765a0b3..7475ac6b3e4337da669583884463b86e6d4bc257 100644 (file)
@@ -17,9 +17,7 @@ type ftoaTest struct {
        s       string;
 }
 
-func fdiv(a, b float64) float64 {
-       return a/b;
-}      // keep compiler in the dark
+func fdiv(a, b float64) float64        { return a/b }  // keep compiler in the dark
 
 const (
        below1e23       = 99999999999999974834176;
index 428c94e0029a96a03731c89ab418a753ef913052..1a3bab2a0365a83f1c6fee405c13b89e09f09a2e 100644 (file)
@@ -6,9 +6,7 @@
 
 package strconv
 
-func NewDecimal(i uint64) *decimal {
-       return newDecimal(i);
-}
+func NewDecimal(i uint64) *decimal     { return newDecimal(i) }
 
 func SetOptimize(b bool) bool {
        old := optimize;
index 15fa3062799d45bdbc2a4570a2ee5bc462d54772..b1025d4a23c203a8b78a53c2f5de84381c353edc 100644 (file)
@@ -36,31 +36,19 @@ func Itob64(i int64, base uint) string {
 }
 
 // Itoa64 returns the decimal string representation of i.
-func Itoa64(i int64) string {
-       return Itob64(i, 10);
-}
+func Itoa64(i int64) string    { return Itob64(i, 10) }
 
 // Uitoa64 returns the decimal string representation of i.
-func Uitoa64(i uint64) string {
-       return Uitob64(i, 10);
-}
+func Uitoa64(i uint64) string  { return Uitob64(i, 10) }
 
 // Uitob returns the string representation of i in the given base.
-func Uitob(i uint, base uint) string {
-       return Uitob64(uint64(i), base);
-}
+func Uitob(i uint, base uint) string   { return Uitob64(uint64(i), base) }
 
 // Itob returns the string representation of i in the given base.
-func Itob(i int, base uint) string {
-       return Itob64(int64(i), base);
-}
+func Itob(i int, base uint) string     { return Itob64(int64(i), base) }
 
 // Itoa returns the decimal string representation of i.
-func Itoa(i int) string {
-       return Itob64(int64(i), 10);
-}
+func Itoa(i int) string        { return Itob64(int64(i), 10) }
 
 // Uitoa returns the decimal string representation of i.
-func Uitoa(i uint) string {
-       return Uitob64(uint64(i), 10);
-}
+func Uitoa(i uint) string      { return Uitob64(uint64(i), 10) }
index d742c49641ded30326ad4e243b42955eda4d8ced..55e4d963f76d5a7237af18744d94ac3eabb67076 100644 (file)
@@ -35,6 +35,4 @@ func (r *Reader) ReadByte() (b byte, err os.Error) {
 
 // NewReader returns a new Reader reading from s.
 // It is similar to bytes.NewBufferString but more efficient and read-only.
-func NewReader(s string) *Reader {
-       return (*Reader)(&s);
-}
+func NewReader(s string) *Reader       { return (*Reader)(&s) }
index 5f3dcfcdc489f983f601e2c3ef89ca0c70c1f9f7..4169f621147db46a3206344c4a5b65770be79cc6 100644 (file)
@@ -107,9 +107,7 @@ func genSplit(s, sep string, sepSave, n int) []string {
 // Split splits the string s around each instance of sep, returning an array of substrings of s.
 // If sep is empty, Split splits s after each UTF-8 sequence.
 // If n > 0, split Splits s into at most n substrings; the last substring will be the unsplit remainder.
-func Split(s, sep string, n int) []string {
-       return genSplit(s, sep, 0, n);
-}
+func Split(s, sep string, n int) []string      { return genSplit(s, sep, 0, n) }
 
 // SplitAfter splits the string s after each instance of sep, returning an array of substrings of s.
 // If sep is empty, SplitAfter splits s after each UTF-8 sequence.
@@ -191,19 +189,13 @@ func Map(mapping func(rune int) int, s string) string {
 }
 
 // ToUpper returns a copy of the string s with all Unicode letters mapped to their upper case.
-func ToUpper(s string) string {
-       return Map(unicode.ToUpper, s);
-}
+func ToUpper(s string) string  { return Map(unicode.ToUpper, s) }
 
 // ToUpper returns a copy of the string s with all Unicode letters mapped to their lower case.
-func ToLower(s string) string {
-       return Map(unicode.ToLower, s);
-}
+func ToLower(s string) string  { return Map(unicode.ToLower, s) }
 
 // ToTitle returns a copy of the string s with all Unicode letters mapped to their title case.
-func ToTitle(s string) string {
-       return Map(unicode.ToTitle, s);
-}
+func ToTitle(s string) string  { return Map(unicode.ToTitle, s) }
 
 // Trim returns a slice of the string s, with all leading and trailing white space
 // removed, as defined by Unicode.
index cdf3437c3d74d012fa82805158a2ebb0e9db7ce3..f7aa4dbaec159a0cc848ce1e22e7c8ba31c448f1 100644 (file)
@@ -74,13 +74,9 @@ func runIndexTests(t *testing.T, f func(s, sep string) int, funcName string, tes
        }
 }
 
-func TestIndex(t *testing.T) {
-       runIndexTests(t, Index, "Index", indexTests);
-}
+func TestIndex(t *testing.T)   { runIndexTests(t, Index, "Index", indexTests) }
 
-func TestLastIndex(t *testing.T) {
-       runIndexTests(t, LastIndex, "LastIndex", lastIndexTests);
-}
+func TestLastIndex(t *testing.T)       { runIndexTests(t, LastIndex, "LastIndex", lastIndexTests) }
 
 
 type ExplodeTest struct {
@@ -249,17 +245,11 @@ func TestMap(t *testing.T) {
        }
 }
 
-func TestToUpper(t *testing.T) {
-       runStringTests(t, ToUpper, "ToUpper", upperTests);
-}
+func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTests) }
 
-func TestToLower(t *testing.T) {
-       runStringTests(t, ToLower, "ToLower", lowerTests);
-}
+func TestToLower(t *testing.T) { runStringTests(t, ToLower, "ToLower", lowerTests) }
 
-func TestTrimSpace(t *testing.T) {
-       runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests);
-}
+func TestTrimSpace(t *testing.T)       { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) }
 
 func equal(m string, s1, s2 string, t *testing.T) bool {
        if s1 == s2 {
index 309970f1e58f00126cab17bf53fd3645d580bcd5..ac59db12de1f8f558d39ba4a64f0dfc92667254e 100644 (file)
@@ -79,17 +79,13 @@ type RWMutex struct {
 // RLock locks rw for reading.
 // If the lock is already locked for writing or there is a writer already waiting
 // to acquire the lock, RLock blocks until the writer has released the lock.
-func (rw *RWMutex) RLock() {
-       rw.m.Lock();
-}
+func (rw *RWMutex) RLock()     { rw.m.Lock() }
 
 // RUnlock undoes a single RLock call;
 // it does not affect other simultaneous readers.
 // It is a run-time error if rw is not locked for reading
 // on entry to RUnlock.
-func (rw *RWMutex) RUnlock() {
-       rw.m.Unlock();
-}
+func (rw *RWMutex) RUnlock()   { rw.m.Unlock() }
 
 // Lock locks rw for writing.
 // If the lock is already locked for reading or writing,
@@ -97,9 +93,7 @@ func (rw *RWMutex) RUnlock() {
 // To ensure that the lock eventually becomes available,
 // a blocked Lock call excludes new readers from acquiring
 // the lock.
-func (rw *RWMutex) Lock() {
-       rw.m.Lock();
-}
+func (rw *RWMutex) Lock()      { rw.m.Lock() }
 
 // Unlock unlocks rw for writing.
 // It is a run-time error if rw is not locked for writing
@@ -109,6 +103,4 @@ func (rw *RWMutex) Lock() {
 // a locked RWMutex is not associated with a particular goroutine.
 // It is allowed for one goroutine to RLock (Lock) an RWMutex and then
 // arrange for another goroutine to RUnlock (Unlock) it.
-func (rw *RWMutex) Unlock() {
-       rw.m.Unlock();
-}
+func (rw *RWMutex) Unlock()    { rw.m.Unlock() }
index eb577f32602a352b740d8ef5bb8e66ec6309ab33..4310b9e1ac93e690ac2ea9caac965a725127e45b 100644 (file)
@@ -71,9 +71,7 @@ func StringArrayPtr(ss []string) []*byte {
        return bb;
 }
 
-func CloseOnExec(fd int) {
-       fcntl(fd, F_SETFD, FD_CLOEXEC);
-}
+func CloseOnExec(fd int)       { fcntl(fd, F_SETFD, FD_CLOEXEC) }
 
 func SetNonblock(fd int, nonblocking bool) (errno int) {
        flag, err := fcntl(fd, F_GETFL, 0);
index c191352558f440c94631437fbac4974191a62b82..89252d1f8b66c5c175d16bb484e88ad2ea154ce7 100644 (file)
@@ -27,6 +27,4 @@ func StringByteSlice(s string) []byte {
 
 // StringBytePtr returns a pointer to a NUL-terminated array of bytes
 // containing the text of s.
-func StringBytePtr(s string) *byte {
-       return &StringByteSlice(s)[0];
-}
+func StringBytePtr(s string) *byte     { return &StringByteSlice(s)[0] }
index 21900554b7f2d59201cab8e2c5febd97ccb3aefe..792dc0bbc581a51cd4a2dfcf3cdbbf5f0d5991fd 100644 (file)
@@ -23,9 +23,7 @@ const OS = "darwin"
 // even linking this function into the binary.  See ../os/getwd.go.
 const ImplementsGetwd = false
 
-func Getwd() (string, int) {
-       return "", ENOTSUP;
-}
+func Getwd() (string, int)     { return "", ENOTSUP }
 
 
 /*
@@ -90,9 +88,7 @@ const (
        stopped = 0x7F;
 )
 
-func (w WaitStatus) Exited() bool {
-       return w&mask == exited;
-}
+func (w WaitStatus) Exited() bool      { return w&mask == exited }
 
 func (w WaitStatus) ExitStatus() int {
        if w&mask != exited {
@@ -101,9 +97,7 @@ func (w WaitStatus) ExitStatus() int {
        return int(w>>shift);
 }
 
-func (w WaitStatus) Signaled() bool {
-       return w&mask != stopped && w&mask != 0;
-}
+func (w WaitStatus) Signaled() bool    { return w&mask != stopped && w&mask != 0 }
 
 func (w WaitStatus) Signal() int {
        sig := int(w&mask);
@@ -113,17 +107,11 @@ func (w WaitStatus) Signal() int {
        return sig;
 }
 
-func (w WaitStatus) CoreDump() bool {
-       return w.Signaled() && w&core != 0;
-}
+func (w WaitStatus) CoreDump() bool    { return w.Signaled() && w&core != 0 }
 
-func (w WaitStatus) Stopped() bool {
-       return w&mask == stopped && w>>shift != SIGSTOP;
-}
+func (w WaitStatus) Stopped() bool     { return w&mask == stopped && w>>shift != SIGSTOP }
 
-func (w WaitStatus) Continued() bool {
-       return w&mask == stopped && w>>shift == SIGSTOP;
-}
+func (w WaitStatus) Continued() bool   { return w&mask == stopped && w>>shift == SIGSTOP }
 
 func (w WaitStatus) StopSignal() int {
        if !w.Stopped() {
index 5654e09da7056408420257a81e2186709c0ca42b..41b7578e34f9e06d9191e3f87c7e21453021657d 100644 (file)
@@ -4,13 +4,9 @@
 
 package syscall
 
-func Getpagesize() int {
-       return 4096;
-}
+func Getpagesize() int { return 4096 }
 
-func TimespecToNsec(ts Timespec) int64 {
-       return int64(ts.Sec)*1e9 + int64(ts.Nsec);
-}
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
 
 func NsecToTimespec(nsec int64) (ts Timespec) {
        ts.Sec = int32(nsec/1e9);
@@ -18,9 +14,7 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
        return;
 }
 
-func TimevalToNsec(tv Timeval) int64 {
-       return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3;
-}
+func TimevalToNsec(tv Timeval) int64   { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
 
 func NsecToTimeval(nsec int64) (tv Timeval) {
        nsec += 999;    // round up to microsecond
index 7522069b1de340b7313c8935f09f6b27d063c7b1..7662b200dabadb3308654ac9e8bbc339dac55d10 100644 (file)
@@ -4,13 +4,9 @@
 
 package syscall
 
-func Getpagesize() int {
-       return 4096;
-}
+func Getpagesize() int { return 4096 }
 
-func TimespecToNsec(ts Timespec) int64 {
-       return int64(ts.Sec)*1e9 + int64(ts.Nsec);
-}
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
 
 func NsecToTimespec(nsec int64) (ts Timespec) {
        ts.Sec = nsec/1e9;
@@ -18,9 +14,7 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
        return;
 }
 
-func TimevalToNsec(tv Timeval) int64 {
-       return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3;
-}
+func TimevalToNsec(tv Timeval) int64   { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
 
 func NsecToTimeval(nsec int64) (tv Timeval) {
        nsec += 999;    // round up to microsecond
index 900889df60a8b4f44c825d6915505354fe154a56..e4b82569e1888372ab1149cda19a7ae79254631a 100644 (file)
@@ -120,25 +120,15 @@ const (
        shift   = 8;
 )
 
-func (w WaitStatus) Exited() bool {
-       return w&mask == exited;
-}
+func (w WaitStatus) Exited() bool      { return w&mask == exited }
 
-func (w WaitStatus) Signaled() bool {
-       return w&mask != stopped && w&mask != exited;
-}
+func (w WaitStatus) Signaled() bool    { return w&mask != stopped && w&mask != exited }
 
-func (w WaitStatus) Stopped() bool {
-       return w&0xFF == stopped;
-}
+func (w WaitStatus) Stopped() bool     { return w&0xFF == stopped }
 
-func (w WaitStatus) Continued() bool {
-       return w == 0xFFFF;
-}
+func (w WaitStatus) Continued() bool   { return w == 0xFFFF }
 
-func (w WaitStatus) CoreDump() bool {
-       return w.Signaled() && w&core != 0;
-}
+func (w WaitStatus) CoreDump() bool    { return w.Signaled() && w&core != 0 }
 
 func (w WaitStatus) ExitStatus() int {
        if !w.Exited() {
@@ -536,17 +526,11 @@ func PtraceCont(pid int, signal int) (errno int) {
        return ptrace(PTRACE_CONT, pid, 0, uintptr(signal));
 }
 
-func PtraceSingleStep(pid int) (errno int) {
-       return ptrace(PTRACE_SINGLESTEP, pid, 0, 0);
-}
+func PtraceSingleStep(pid int) (errno int)     { return ptrace(PTRACE_SINGLESTEP, pid, 0, 0) }
 
-func PtraceAttach(pid int) (errno int) {
-       return ptrace(PTRACE_ATTACH, pid, 0, 0);
-}
+func PtraceAttach(pid int) (errno int) { return ptrace(PTRACE_ATTACH, pid, 0, 0) }
 
-func PtraceDetach(pid int) (errno int) {
-       return ptrace(PTRACE_DETACH, pid, 0, 0);
-}
+func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0) }
 
 // Sendto
 // Recvfrom
index 796859c0a8b8c31af59098d2c8d2c71b59e4a140..9632a889ef380620f9b513e57896ebcbcd680adf 100644 (file)
@@ -6,13 +6,9 @@ package syscall
 
 import "unsafe"
 
-func Getpagesize() int {
-       return 4096;
-}
+func Getpagesize() int { return 4096 }
 
-func TimespecToNsec(ts Timespec) int64 {
-       return int64(ts.Sec)*1e9 + int64(ts.Nsec);
-}
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
 
 func NsecToTimespec(nsec int64) (ts Timespec) {
        ts.Sec = int32(nsec/1e9);
@@ -20,9 +16,7 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
        return;
 }
 
-func TimevalToNsec(tv Timeval) int64 {
-       return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3;
-}
+func TimevalToNsec(tv Timeval) int64   { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
 
 func NsecToTimeval(nsec int64) (tv Timeval) {
        nsec += 999;    // round up to microsecond
@@ -151,10 +145,6 @@ func Listen(s int, n int) (errno int) {
        return;
 }
 
-func (r *PtraceRegs) PC() uint64 {
-       return uint64(uint32(r.Eip));
-}
+func (r *PtraceRegs) PC() uint64       { return uint64(uint32(r.Eip)) }
 
-func (r *PtraceRegs) SetPC(pc uint64) {
-       r.Eip = int32(pc);
-}
+func (r *PtraceRegs) SetPC(pc uint64)  { r.Eip = int32(pc) }
index 685fc1b4812561bc3b65865443b36072d3576284..3ad3f3a2bdf4becb7e4a2a82b850ddd3931608b8 100644 (file)
@@ -42,13 +42,9 @@ package syscall
 //sys  recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int)
 //sys  sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int)
 
-func Getpagesize() int {
-       return 4096;
-}
+func Getpagesize() int { return 4096 }
 
-func TimespecToNsec(ts Timespec) int64 {
-       return int64(ts.Sec)*1e9 + int64(ts.Nsec);
-}
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
 
 func NsecToTimespec(nsec int64) (ts Timespec) {
        ts.Sec = nsec/1e9;
@@ -56,9 +52,7 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
        return;
 }
 
-func TimevalToNsec(tv Timeval) int64 {
-       return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3;
-}
+func TimevalToNsec(tv Timeval) int64   { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
 
 func NsecToTimeval(nsec int64) (tv Timeval) {
        nsec += 999;    // round up to microsecond
@@ -67,10 +61,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
        return;
 }
 
-func (r *PtraceRegs) PC() uint64 {
-       return r.Rip;
-}
+func (r *PtraceRegs) PC() uint64       { return r.Rip }
 
-func (r *PtraceRegs) SetPC(pc uint64) {
-       r.Rip = pc;
-}
+func (r *PtraceRegs) SetPC(pc uint64)  { r.Rip = pc }
index d71b2e15451da71a71bcee33ef316e19cccf6a77..36f19906a11d82b0bf001494c8eaf236e5a282bd 100644 (file)
@@ -4,13 +4,9 @@
 
 package syscall
 
-func Getpagesize() int {
-       return 4096;
-}
+func Getpagesize() int { return 4096 }
 
-func TimespecToNsec(ts Timespec) int64 {
-       return int64(ts.Sec)*1e9 + int64(ts.Nsec);
-}
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
 
 func NsecToTimespec(nsec int64) (ts Timespec) {
        ts.Sec = int32(nsec/1e9);
@@ -62,9 +58,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
 //sys  Statfs(path string, buf *Statfs_t) (errno int)
 
 // TODO(kaib): add support for tracing
-func (r *PtraceRegs) PC() uint64 {
-       return 0;
-}
+func (r *PtraceRegs) PC() uint64       { return 0 }
 
-func (r *PtraceRegs) SetPC(pc uint64) {
-}
+func (r *PtraceRegs) SetPC(pc uint64)  {}
index 3efea2e961e85a726d8810e4fae1ce0c11deed9f..9b3266809cb5226b70baa2f3c41f6f460924c6f3 100644 (file)
@@ -114,9 +114,7 @@ const (
        SIGTRAP = 5;
 )
 
-func Pipe(p []int) (errno int) {
-       return ENACL;
-}
+func Pipe(p []int) (errno int) { return ENACL }
 
 func fcntl(fd, cmd, arg int) (val int, errno int) {
        return 0, ENACL;
@@ -130,45 +128,31 @@ func Pwrite(fd int, p []byte, offset int64) (n int, errno int) {
        return 0, ENACL;
 }
 
-func Mkdir(path string, mode int) (errno int) {
-       return ENACL;
-}
+func Mkdir(path string, mode int) (errno int)  { return ENACL }
 
 func Lstat(path string, stat *Stat_t) (errno int) {
        return ENACL;
 }
 
-func Chdir(path string) (errno int) {
-       return ENACL;
-}
+func Chdir(path string) (errno int)    { return ENACL }
 
-func Fchdir(fd int) (errno int) {
-       return ENACL;
-}
+func Fchdir(fd int) (errno int)        { return ENACL }
 
-func Unlink(path string) (errno int) {
-       return ENACL;
-}
+func Unlink(path string) (errno int)   { return ENACL }
 
-func Rmdir(path string) (errno int) {
-       return ENACL;
-}
+func Rmdir(path string) (errno int)    { return ENACL }
 
 func Link(oldpath, newpath string) (errno int) {
        return ENACL;
 }
 
-func Symlink(path, link string) (errno int) {
-       return ENACL;
-}
+func Symlink(path, link string) (errno int)    { return ENACL }
 
 func Readlink(path string, buf []byte) (n int, errno int) {
        return 0, ENACL;
 }
 
-func Fchmod(fd int, mode int) (errno int) {
-       return ENACL;
-}
+func Fchmod(fd int, mode int) (errno int)      { return ENACL }
 
 func Chown(path string, uid int, gid int) (errno int) {
        return ENACL;
@@ -196,33 +180,19 @@ func Ftruncate(fd int, length int64) (errno int) {
 
 const ImplementsGetwd = true
 
-func Getwd() (wd string, errno int) {
-       return "", ENACL;
-}
+func Getwd() (wd string, errno int)    { return "", ENACL }
 
-func Getuid() (uid int) {
-       return -1;
-}
+func Getuid() (uid int)        { return -1 }
 
-func Geteuid() (euid int) {
-       return -1;
-}
+func Geteuid() (euid int)      { return -1 }
 
-func Getgid() (gid int) {
-       return -1;
-}
+func Getgid() (gid int)        { return -1 }
 
-func Getegid() (egid int) {
-       return -1;
-}
+func Getegid() (egid int)      { return -1 }
 
-func Getppid() (ppid int) {
-       return -1;
-}
+func Getppid() (ppid int)      { return -1 }
 
-func Getgroups() (gids []int, errno int) {
-       return nil, ENACL;
-}
+func Getgroups() (gids []int, errno int)       { return nil, ENACL }
 
 type Sockaddr interface {
        sockaddr();
@@ -233,23 +203,20 @@ type SockaddrInet4 struct {
        Addr    [4]byte;
 }
 
-func (*SockaddrInet4) sockaddr() {
-}
+func (*SockaddrInet4) sockaddr()       {}
 
 type SockaddrInet6 struct {
        Port    int;
        Addr    [16]byte;
 }
 
-func (*SockaddrInet6) sockaddr() {
-}
+func (*SockaddrInet6) sockaddr()       {}
 
 type SockaddrUnix struct {
        Name string;
 }
 
-func (*SockaddrUnix) sockaddr() {
-}
+func (*SockaddrUnix) sockaddr()        {}
 
 const (
        AF_INET = 1+iota;
@@ -284,13 +251,9 @@ func Getpeername(fd int) (sa Sockaddr, errno int) {
        return nil, ENACL;
 }
 
-func Bind(fd int, sa Sockaddr) (errno int) {
-       return ENACL;
-}
+func Bind(fd int, sa Sockaddr) (errno int)     { return ENACL }
 
-func Connect(fd int, sa Sockaddr) (errno int) {
-       return ENACL;
-}
+func Connect(fd int, sa Sockaddr) (errno int)  { return ENACL }
 
 func Socket(domain, typ, proto int) (fd, errno int) {
        return 0, ENACL;
@@ -313,9 +276,7 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
        return ENACL;
 }
 
-func Listen(s int, n int) (errno int) {
-       return ENACL;
-}
+func Listen(s int, n int) (errno int)  { return ENACL }
 
 type Rusage struct {
        Utime           Timeval;
@@ -342,38 +303,20 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
 
 type WaitStatus uint32
 
-func (WaitStatus) Exited() bool {
-       return false;
-}
+func (WaitStatus) Exited() bool        { return false }
 
-func (WaitStatus) ExitStatus() int {
-       return -1;
-}
+func (WaitStatus) ExitStatus() int     { return -1 }
 
-func (WaitStatus) Signal() int {
-       return -1;
-}
+func (WaitStatus) Signal() int { return -1 }
 
-func (WaitStatus) CoreDump() bool {
-       return false;
-}
+func (WaitStatus) CoreDump() bool      { return false }
 
-func (WaitStatus) Stopped() bool {
-       return false;
-}
+func (WaitStatus) Stopped() bool       { return false }
 
-func (WaitStatus) Continued() bool {
-       return false;
-}
+func (WaitStatus) Continued() bool     { return false }
 
-func (WaitStatus) StopSignal() int {
-       return -1;
-}
+func (WaitStatus) StopSignal() int     { return -1 }
 
-func (WaitStatus) Signaled() bool {
-       return false;
-}
+func (WaitStatus) Signaled() bool      { return false }
 
-func (WaitStatus) TrapCause() int {
-       return -1;
-}
+func (WaitStatus) TrapCause() int      { return -1 }
index e87c1ffbf921e2bf88b24f25bbb5976027104e50..badc4b25b472f646b49cc71c8fb88804fad23e7a 100644 (file)
@@ -4,9 +4,7 @@
 
 package syscall
 
-func Getpagesize() int {
-       return 4096;
-}
+func Getpagesize() int { return 4096 }
 
 func NsecToTimeval(nsec int64) (tv Timeval) {
        tv.Sec = int32(nsec/1e9);
index 02691b856a7988ed42eab23457ebb257fa047e6e..d0d743f3ecf0d202fec9fce8d680b652ba7a1ed7 100644 (file)
@@ -315,5 +315,4 @@ const (
        SYS_FALLOCATE                   = 324;
 )
 
-func _darwin_system_call_conflict() {
-}
+func _darwin_system_call_conflict()    {}
index 74faa9578784993544ad43bdaa5cace901882eff..055e65b5d7caaae91725a2d55163c1800c96b7a1 100644 (file)
@@ -292,5 +292,4 @@ const (
        SYS_FALLOCATE                   = 285;
 )
 
-func _darwin_system_call_conflict() {
-}
+func _darwin_system_call_conflict()    {}
index a493bfe9c8e5009afacd3011a2d46d270b42aadc..d1936c049ea11e1edd8c0dfac371703f1d14e0b1 100644 (file)
@@ -333,5 +333,4 @@ const (
        SYS_INOTIFY_INIT1               = (SYS_SYSCALL_BASE + 360);
 )
 
-func _darwin_system_call_conflict() {
-}
+func _darwin_system_call_conflict()    {}
index d7d030893b6b5d0feb74aa483b9266627b7ded7a..9370bb4a0b2ebbca5f1daacb2d4e6faebbe6d881 100644 (file)
@@ -92,14 +92,10 @@ type Writer struct {
 }
 
 
-func (b *Writer) addLine() {
-       b.lines.Push(vector.New(0));
-}
+func (b *Writer) addLine()     { b.lines.Push(vector.New(0)) }
 
 
-func (b *Writer) line(i int) *vector.Vector {
-       return b.lines.At(i).(*vector.Vector);
-}
+func (b *Writer) line(i int) *vector.Vector    { return b.lines.At(i).(*vector.Vector) }
 
 
 // Reset the current state.
index 0a290601f2bcd6fbc10b7b3eade402c71a85d027..6016e36cfefdbed0a1a095a00395b339b00a566d 100644 (file)
@@ -16,14 +16,10 @@ type buffer struct {
 }
 
 
-func (b *buffer) init(n int) {
-       b.a = make([]byte, n)[0:0];
-}
+func (b *buffer) init(n int)   { b.a = make([]byte, n)[0:0] }
 
 
-func (b *buffer) clear() {
-       b.a = b.a[0:0];
-}
+func (b *buffer) clear()       { b.a = b.a[0:0] }
 
 
 func (b *buffer) Write(buf []byte) (written int, err os.Error) {
@@ -41,9 +37,7 @@ func (b *buffer) Write(buf []byte) (written int, err os.Error) {
 }
 
 
-func (b *buffer) String() string {
-       return string(b.a);
-}
+func (b *buffer) String() string       { return string(b.a) }
 
 
 func write(t *testing.T, testname string, w *Writer, src string) {
index c647a2d3790d655c78c2cb7e0ab41748976d7d25..728b7a529a95faea837280d4194c8f45c09ba822 100644 (file)
@@ -72,9 +72,7 @@ type Error struct {
        Msg     string;
 }
 
-func (e *Error) String() string {
-       return fmt.Sprintf("line %d: %s", e.Line, e.Msg);
-}
+func (e *Error) String() string        { return fmt.Sprintf("line %d: %s", e.Line, e.Msg) }
 
 // Most of the literals are aces.
 var lbrace = []byte{'{'}
@@ -196,9 +194,7 @@ func (t *Template) parseError(err string, args ...) {
 // -- Lexical analysis
 
 // Is c a white space character?
-func white(c uint8) bool {
-       return c == ' ' || c == '\t' || c == '\r' || c == '\n';
-}
+func white(c uint8) bool       { return c == ' ' || c == '\t' || c == '\r' || c == '\n' }
 
 // Safely, does s[n:n+len(t)] == t?
 func equal(s []byte, n int, t []byte) bool {
index becfa0f0b5825dc3eeb73b506db81f883d42e44f..6fbc147265b79a321dff4f956512a2ef4ae5c4be 100644 (file)
@@ -59,7 +59,9 @@ func plus1(v interface{}) string {
 }
 
 func writer(f func(interface{}) string) (func(io.Writer, interface{}, string)) {
-       return func(w io.Writer, v interface{}, format string) { io.WriteString(w, f(v)) };
+       return func(w io.Writer, v interface{}, format string) {
+               io.WriteString(w, f(v));
+       };
 }
 
 
index 823124aa3550f1c7a06e6e9b295aea9c69e377c0..ae427e6fab172c841d2fc670070b69d7632b8b10 100644 (file)
@@ -14,9 +14,7 @@ import (
 
 // OneByteReader returns a Reader that implements
 // each non-empty Read by reading one byte from r.
-func OneByteReader(r io.Reader) io.Reader {
-       return &oneByteReader{r};
-}
+func OneByteReader(r io.Reader) io.Reader      { return &oneByteReader{r} }
 
 type oneByteReader struct {
        r io.Reader;
@@ -31,9 +29,7 @@ func (r *oneByteReader) Read(p []byte) (int, os.Error) {
 
 // HalfReader returns a Reader that implements Read
 // by reading half as many requested bytes from r.
-func HalfReader(r io.Reader) io.Reader {
-       return &halfReader{r};
-}
+func HalfReader(r io.Reader) io.Reader { return &halfReader{r} }
 
 type halfReader struct {
        r io.Reader;
@@ -47,9 +43,7 @@ func (r *halfReader) Read(p []byte) (int, os.Error) {
 // DataErrReader returns a Reader that returns the final
 // error with the last data read, instead of by itself with
 // zero bytes of data.
-func DataErrReader(r io.Reader) io.Reader {
-       return &dataErrReader{r, nil, make([]byte, 1024)};
-}
+func DataErrReader(r io.Reader) io.Reader      { return &dataErrReader{r, nil, make([]byte, 1024)} }
 
 type dataErrReader struct {
        r       io.Reader;
index 5a7e8d37a5bae1476ddefda2ee57ad88e31ce704..3d47240bda46d206eee4101d14e53e9cb60833c0 100644 (file)
@@ -43,9 +43,7 @@ func randFloat64(rand *rand.Rand) float64 {
 }
 
 // randInt64 returns a random integer taking half the range of an int64.
-func randInt64(rand *rand.Rand) int64 {
-       return rand.Int63() - 1<<62;
-}
+func randInt64(rand *rand.Rand) int64  { return rand.Int63() - 1<<62 }
 
 // complexSize is the maximum length of arbitrary values that contain other
 // values.
@@ -195,9 +193,7 @@ func (c *Config) getMaxCount() (maxCount int) {
 // used, independent of the functions being tested.
 type SetupError string
 
-func (s SetupError) String() string {
-       return string(s);
-}
+func (s SetupError) String() string    { return string(s) }
 
 // A CheckError is the result of Check finding an error.
 type CheckError struct {
index 290f171eaffd0468b0cfc1e034d4af8444a5a724..951582e35e0fbfdf43390297cef5d36025e2ccdb 100644 (file)
@@ -11,90 +11,50 @@ import (
        "os";
 )
 
-func fBool(a bool) bool {
-       return a;
-}
+func fBool(a bool) bool        { return a }
 
-func fFloat32(a float32) float32 {
-       return a;
-}
+func fFloat32(a float32) float32       { return a }
 
-func fFloat64(a float64) float64 {
-       return a;
-}
+func fFloat64(a float64) float64       { return a }
 
-func fFloat(a float) float {
-       return a;
-}
+func fFloat(a float) float     { return a }
 
-func fInt16(a int16) int16 {
-       return a;
-}
+func fInt16(a int16) int16     { return a }
 
-func fInt32(a int32) int32 {
-       return a;
-}
+func fInt32(a int32) int32     { return a }
 
-func fInt64(a int64) int64 {
-       return a;
-}
+func fInt64(a int64) int64     { return a }
 
-func fInt8(a int8) int8 {
-       return a;
-}
+func fInt8(a int8) int8        { return a }
 
-func fInt(a int) int {
-       return a;
-}
+func fInt(a int) int   { return a }
 
-func fUInt8(a uint8) uint8 {
-       return a;
-}
+func fUInt8(a uint8) uint8     { return a }
 
-func fMap(a map[int]int) map[int]int {
-       return a;
-}
+func fMap(a map[int]int) map[int]int   { return a }
 
-func fSlice(a []byte) []byte {
-       return a;
-}
+func fSlice(a []byte) []byte   { return a }
 
-func fString(a string) string {
-       return a;
-}
+func fString(a string) string  { return a }
 
 type TestStruct struct {
        A       int;
        B       string;
 }
 
-func fStruct(a TestStruct) TestStruct {
-       return a;
-}
+func fStruct(a TestStruct) TestStruct  { return a }
 
-func fUint16(a uint16) uint16 {
-       return a;
-}
+func fUint16(a uint16) uint16  { return a }
 
-func fUint32(a uint32) uint32 {
-       return a;
-}
+func fUint32(a uint32) uint32  { return a }
 
-func fUint64(a uint64) uint64 {
-       return a;
-}
+func fUint64(a uint64) uint64  { return a }
 
-func fUint8(a uint8) uint8 {
-       return a;
-}
+func fUint8(a uint8) uint8     { return a }
 
-func fUint(a uint) uint {
-       return a;
-}
+func fUint(a uint) uint        { return a }
 
-func fUintptr(a uintptr) uintptr {
-       return a;
-}
+func fUintptr(a uintptr) uintptr       { return a }
 
 func fIntptr(a *int) *int {
        b := *a;
@@ -142,9 +102,7 @@ func (m myStruct) Generate(r *rand.Rand, _ int) reflect.Value {
        return reflect.NewValue(myStruct{x: 42});
 }
 
-func myStructProperty(in myStruct) bool {
-       return in.x == 42;
-}
+func myStructProperty(in myStruct) bool        { return in.x == 42 }
 
 func TestCheckProperty(t *testing.T) {
        reportError("myStructProperty", Check(myStructProperty, nil), t);
index a91ae4dbb4b41f79d67479f5692579082e4328f8..f4cfe5e6e25bcea9fa78c3b6189b1d68b6b4c74e 100644 (file)
@@ -60,18 +60,10 @@ type common struct {
        _index  int;
 }
 
-func (c *common) next() instr {
-       return c._next;
-}
-func (c *common) setNext(i instr) {
-       c._next = i;
-}
-func (c *common) index() int {
-       return c._index;
-}
-func (c *common) setIndex(i int) {
-       c._index = i;
-}
+func (c *common) next() instr          { return c._next }
+func (c *common) setNext(i instr)      { c._next = i }
+func (c *common) index() int           { return c._index }
+func (c *common) setIndex(i int)       { c._index = i }
 
 // The representation of a compiled regular expression.
 // The public interface is entirely through methods.
@@ -103,48 +95,32 @@ type _Start struct {
        common;
 }
 
-func (start *_Start) kind() int {
-       return _START;
-}
-func (start *_Start) print() {
-       print("start");
-}
+func (start *_Start) kind() int        { return _START }
+func (start *_Start) print()   { print("start") }
 
 // --- END end of program
 type _End struct {
        common;
 }
 
-func (end *_End) kind() int {
-       return _END;
-}
-func (end *_End) print() {
-       print("end");
-}
+func (end *_End) kind() int    { return _END }
+func (end *_End) print()       { print("end") }
 
 // --- BOT beginning of text
 type _Bot struct {
        common;
 }
 
-func (bot *_Bot) kind() int {
-       return _BOT;
-}
-func (bot *_Bot) print() {
-       print("bot");
-}
+func (bot *_Bot) kind() int    { return _BOT }
+func (bot *_Bot) print()       { print("bot") }
 
 // --- EOT end of text
 type _Eot struct {
        common;
 }
 
-func (eot *_Eot) kind() int {
-       return _EOT;
-}
-func (eot *_Eot) print() {
-       print("eot");
-}
+func (eot *_Eot) kind() int    { return _EOT }
+func (eot *_Eot) print()       { print("eot") }
 
 // --- CHAR a regular character
 type _Char struct {
@@ -152,12 +128,8 @@ type _Char struct {
        char    int;
 }
 
-func (char *_Char) kind() int {
-       return _CHAR;
-}
-func (char *_Char) print() {
-       print("char ", string(char.char));
-}
+func (char *_Char) kind() int  { return _CHAR }
+func (char *_Char) print()     { print("char ", string(char.char)) }
 
 func newChar(char int) *_Char {
        c := new(_Char);
@@ -175,9 +147,7 @@ type _CharClass struct {
        ranges  []int;
 }
 
-func (cclass *_CharClass) kind() int {
-       return _CHARCLASS;
-}
+func (cclass *_CharClass) kind() int   { return _CHARCLASS }
 
 func (cclass *_CharClass) print() {
        print("charclass");
@@ -234,24 +204,16 @@ type _Any struct {
        common;
 }
 
-func (any *_Any) kind() int {
-       return _ANY;
-}
-func (any *_Any) print() {
-       print("any");
-}
+func (any *_Any) kind() int    { return _ANY }
+func (any *_Any) print()       { print("any") }
 
 // --- NOTNL any character but newline
 type _NotNl struct {
        common;
 }
 
-func (notnl *_NotNl) kind() int {
-       return _NOTNL;
-}
-func (notnl *_NotNl) print() {
-       print("notnl");
-}
+func (notnl *_NotNl) kind() int        { return _NOTNL }
+func (notnl *_NotNl) print()   { print("notnl") }
 
 // --- BRA parenthesized expression
 type _Bra struct {
@@ -259,12 +221,8 @@ type _Bra struct {
        n       int;    // subexpression number
 }
 
-func (bra *_Bra) kind() int {
-       return _BRA;
-}
-func (bra *_Bra) print() {
-       print("bra", bra.n);
-}
+func (bra *_Bra) kind() int    { return _BRA }
+func (bra *_Bra) print()       { print("bra", bra.n) }
 
 // --- EBRA end of parenthesized expression
 type _Ebra struct {
@@ -272,12 +230,8 @@ type _Ebra struct {
        n       int;    // subexpression number
 }
 
-func (ebra *_Ebra) kind() int {
-       return _EBRA;
-}
-func (ebra *_Ebra) print() {
-       print("ebra ", ebra.n);
-}
+func (ebra *_Ebra) kind() int  { return _EBRA }
+func (ebra *_Ebra) print()     { print("ebra ", ebra.n) }
 
 // --- ALT alternation
 type _Alt struct {
@@ -285,24 +239,16 @@ type _Alt struct {
        left    instr;  // other branch
 }
 
-func (alt *_Alt) kind() int {
-       return _ALT;
-}
-func (alt *_Alt) print() {
-       print("alt(", alt.left.index(), ")");
-}
+func (alt *_Alt) kind() int    { return _ALT }
+func (alt *_Alt) print()       { print("alt(", alt.left.index(), ")") }
 
 // --- NOP no operation
 type _Nop struct {
        common;
 }
 
-func (nop *_Nop) kind() int {
-       return _NOP;
-}
-func (nop *_Nop) print() {
-       print("nop");
-}
+func (nop *_Nop) kind() int    { return _NOP }
+func (nop *_Nop) print()       { print("nop") }
 
 func (re *Regexp) add(i instr) instr {
        n := len(re.inst);
@@ -329,9 +275,7 @@ type parser struct {
 
 const endOfFile = -1
 
-func (p *parser) c() int {
-       return p.ch;
-}
+func (p *parser) c() int       { return p.ch }
 
 func (p *parser) nextc() int {
        if p.pos >= len(p.re.expr) {
@@ -837,23 +781,17 @@ func (re *Regexp) ExecuteString(s string) (a []int) {
 //    b[a[2*i]:a[2*i+1]] for i > 0 is the subslice matched by the ith parenthesized subexpression.
 // A negative value means the subexpression did not match any element of the slice.
 // An empty array means "no match".
-func (re *Regexp) Execute(b []byte) (a []int) {
-       return re.doExecute("", b, 0);
-}
+func (re *Regexp) Execute(b []byte) (a []int)  { return re.doExecute("", b, 0) }
 
 
 // MatchString returns whether the Regexp matches the string s.
 // The return value is a boolean: true for match, false for no match.
-func (re *Regexp) MatchString(s string) bool {
-       return len(re.doExecute(s, nil, 0)) > 0;
-}
+func (re *Regexp) MatchString(s string) bool   { return len(re.doExecute(s, nil, 0)) > 0 }
 
 
 // Match returns whether the Regexp matches the byte slice b.
 // The return value is a boolean: true for match, false for no match.
-func (re *Regexp) Match(b []byte) bool {
-       return len(re.doExecute("", b, 0)) > 0;
-}
+func (re *Regexp) Match(b []byte) bool { return len(re.doExecute("", b, 0)) > 0 }
 
 
 // MatchStrings matches the Regexp against the string s.
index 65ccb09dd9303971f8d02f9321fce0a75ce904b3..6bf6ca26fb215e4541825c6c8d967b2b905e92f0 100644 (file)
@@ -57,17 +57,11 @@ type Recv struct {
        Expected        interface{};
 }
 
-func (r Recv) getRecv() recvAction {
-       return r;
-}
+func (r Recv) getRecv() recvAction     { return r }
 
-func (Recv) getSend() sendAction {
-       return nil;
-}
+func (Recv) getSend() sendAction       { return nil }
 
-func (r Recv) getChannel() interface{} {
-       return r.Channel;
-}
+func (r Recv) getChannel() interface{} { return r.Channel }
 
 func (r Recv) recvMatch(chanEvent interface{}) bool {
        c, ok := chanEvent.(channelRecv);
@@ -85,17 +79,11 @@ type RecvMatch struct {
        Match   func(interface{}) bool;
 }
 
-func (r RecvMatch) getRecv() recvAction {
-       return r;
-}
+func (r RecvMatch) getRecv() recvAction        { return r }
 
-func (RecvMatch) getSend() sendAction {
-       return nil;
-}
+func (RecvMatch) getSend() sendAction  { return nil }
 
-func (r RecvMatch) getChannel() interface{} {
-       return r.Channel;
-}
+func (r RecvMatch) getChannel() interface{}    { return r.Channel }
 
 func (r RecvMatch) recvMatch(chanEvent interface{}) bool {
        c, ok := chanEvent.(channelRecv);
@@ -113,17 +101,11 @@ type Closed struct {
        Channel interface{};
 }
 
-func (r Closed) getRecv() recvAction {
-       return r;
-}
+func (r Closed) getRecv() recvAction   { return r }
 
-func (Closed) getSend() sendAction {
-       return nil;
-}
+func (Closed) getSend() sendAction     { return nil }
 
-func (r Closed) getChannel() interface{} {
-       return r.Channel;
-}
+func (r Closed) getChannel() interface{}       { return r.Channel }
 
 func (r Closed) recvMatch(chanEvent interface{}) bool {
        c, ok := chanEvent.(channelClosed);
@@ -141,17 +123,11 @@ type Send struct {
        Value   interface{};
 }
 
-func (Send) getRecv() recvAction {
-       return nil;
-}
+func (Send) getRecv() recvAction       { return nil }
 
-func (s Send) getSend() sendAction {
-       return s;
-}
+func (s Send) getSend() sendAction     { return s }
 
-func (s Send) getChannel() interface{} {
-       return s.Channel;
-}
+func (s Send) getChannel() interface{} { return s.Channel }
 
 func newEmptyInterface(args ...) reflect.Value {
        return reflect.NewValue(args).(*reflect.StructValue).Field(0);
@@ -176,21 +152,13 @@ type Close struct {
        Channel interface{};
 }
 
-func (Close) getRecv() recvAction {
-       return nil;
-}
+func (Close) getRecv() recvAction      { return nil }
 
-func (s Close) getSend() sendAction {
-       return s;
-}
+func (s Close) getSend() sendAction    { return s }
 
-func (s Close) getChannel() interface{} {
-       return s.Channel;
-}
+func (s Close) getChannel() interface{}        { return s.Channel }
 
-func (s Close) send() {
-       reflect.NewValue(s.Channel).(*reflect.ChanValue).Close();
-}
+func (s Close) send()  { reflect.NewValue(s.Channel).(*reflect.ChanValue).Close() }
 
 // A ReceivedUnexpected error results if no active Events match a value
 // received from a channel.
@@ -211,9 +179,7 @@ func (r ReceivedUnexpected) String() string {
 // Events.
 type SetupError string
 
-func (s SetupError) String() string {
-       return string(s);
-}
+func (s SetupError) String() string    { return string(s) }
 
 func NewEvent(name string, predecessors []*Event, action action) *Event {
        e := &Event{name, false, predecessors, action};
index e8dfee2bde6336121b16c2464d625b6c1d9e9946..b04e8d40cc1fce00b5aa020a310840945c8db925 100644 (file)
@@ -47,14 +47,10 @@ type T struct {
 }
 
 // Fail marks the Test function as having failed but continues execution.
-func (t *T) Fail() {
-       t.failed = true;
-}
+func (t *T) Fail()     { t.failed = true }
 
 // Failed returns whether the Test function has failed.
-func (t *T) Failed() bool {
-       return t.failed;
-}
+func (t *T) Failed() bool      { return t.failed }
 
 // FailNow marks the Test function as having failed and stops its execution.
 // Execution will continue at the next Test.
@@ -66,9 +62,7 @@ func (t *T) FailNow() {
 
 // Log formats its arguments using default formatting, analogous to Print(),
 // and records the text in the error log.
-func (t *T) Log(args ...) {
-       t.errors += "\t"+tabify(fmt.Sprintln(args));
-}
+func (t *T) Log(args ...)      { t.errors += "\t"+tabify(fmt.Sprintln(args)) }
 
 // Log formats its arguments according to the format, analogous to Printf(),
 // and records the text in the error log.
index ee57edd454eb7ba90a9fea3e8dad5b11d0951109..e94057a16ca7cce849fc447959c944d35f8b3e32 100644 (file)
@@ -11,6 +11,4 @@ import (
 
 // Sleep pauses the current goroutine for ns nanoseconds.
 // It returns os.EINTR if interrupted.
-func Sleep(ns int64) os.Error {
-       return os.NewSyscallError("sleep", syscall.Sleep(ns));
-}
+func Sleep(ns int64) os.Error  { return os.NewSyscallError("sleep", syscall.Sleep(ns)) }
index 01ffef4a187d6719be3f2aec8a8b29bf6cc17d93..771fc9f7e580d78170c0f0b9ffe485cdcc51dc53 100644 (file)
@@ -29,9 +29,7 @@ type Ticker struct {
 }
 
 // Stop turns off a ticker.  After Stop, no more ticks will be delivered.
-func (t *Ticker) Stop() {
-       t.shutdown = true;
-}
+func (t *Ticker) Stop()        { t.shutdown = true }
 
 func (t *Ticker) ticker(c chan<- int64) {
        now := Nanoseconds();
index 3b626bbabf0d9f5cc395c2d82950fac122669843..72cd348221aca2650f254481885f2f1bf0c7b136 100644 (file)
@@ -145,9 +145,7 @@ func SecondsToUTC(sec int64) *Time {
 }
 
 // UTC returns the current time as a parsed Time value in the UTC time zone.
-func UTC() *Time {
-       return SecondsToUTC(Seconds());
-}
+func UTC() *Time       { return SecondsToUTC(Seconds()) }
 
 // SecondsToLocalTime converts sec, in number of seconds since the Unix epoch,
 // into a parsed Time value in the local time zone.
@@ -160,9 +158,7 @@ func SecondsToLocalTime(sec int64) *Time {
 }
 
 // LocalTime returns the current time as a parsed Time value in the local time zone.
-func LocalTime() *Time {
-       return SecondsToLocalTime(Seconds());
-}
+func LocalTime() *Time { return SecondsToLocalTime(Seconds()) }
 
 // Seconds returns the number of seconds since January 1, 1970 represented by the
 // parsed Time value.
@@ -340,24 +336,16 @@ func format(t *Time, fmt string) string {
 
 // Asctime formats the parsed time value in the style of
 // ANSI C asctime: Sun Nov  6 08:49:37 1994
-func (t *Time) Asctime() string {
-       return format(t, "%a %b %e %H:%M:%S %Y");
-}
+func (t *Time) Asctime() string        { return format(t, "%a %b %e %H:%M:%S %Y") }
 
 // RFC850 formats the parsed time value in the style of
 // RFC 850: Sunday, 06-Nov-94 08:49:37 UTC
-func (t *Time) RFC850() string {
-       return format(t, "%A, %d-%b-%y %H:%M:%S %Z");
-}
+func (t *Time) RFC850() string { return format(t, "%A, %d-%b-%y %H:%M:%S %Z") }
 
 // RFC1123 formats the parsed time value in the style of
 // RFC 1123: Sun, 06 Nov 1994 08:49:37 UTC
-func (t *Time) RFC1123() string {
-       return format(t, "%a, %d %b %Y %H:%M:%S %Z");
-}
+func (t *Time) RFC1123() string        { return format(t, "%a, %d %b %Y %H:%M:%S %Z") }
 
 // String formats the parsed time value in the style of
 // date(1) - Sun Nov  6 08:49:37 UTC 1994
-func (t *Time) String() string {
-       return format(t, "%a %b %e %H:%M:%S %Z %Y");
-}
+func (t *Time) String() string { return format(t, "%a %b %e %H:%M:%S %Z %Y") }
index 18ae7cf5895bed5d28d9482ede76da8e9bf894be..89cdc99567d2567734d797f93fee42abe95be3da 100644 (file)
@@ -291,6 +291,4 @@ func RuneCountInString(s string) int {
 // RuneStart reports whether the byte could be the first byte of
 // an encoded rune.  Second and subsequent bytes always have the top
 // two bits set to 10.
-func RuneStart(b byte) bool {
-       return b&0xC0 != 0x80;
-}
+func RuneStart(b byte) bool    { return b&0xC0 != 0x80 }
index 152a80dc08c482498cd3fb9e4f1b157cd42cc7bf..a33188e26bfcafd4874de6e5aeede371c9adc6fe 100644 (file)
@@ -128,9 +128,7 @@ func Unmarshal(r io.Reader, val interface{}) os.Error {
 // An UnmarshalError represents an error in the unmarshalling process.
 type UnmarshalError string
 
-func (e UnmarshalError) String() string {
-       return string(e);
-}
+func (e UnmarshalError) String() string        { return string(e) }
 
 // The Parser's Unmarshal method is like xml.Unmarshal
 // except that it can be passed a pointer to the initial start element,
index 2f33f2d85d876304e47b3a6cabcfe5e4121b2049..52ef78f2f912d71449039f385183d4873747673d 100644 (file)
@@ -28,9 +28,7 @@ import (
 // A SyntaxError represents a syntax error in the XML input stream.
 type SyntaxError string
 
-func (e SyntaxError) String() string {
-       return "XML syntax error: " + string(e);
-}
+func (e SyntaxError) String() string   { return "XML syntax error: " + string(e) }
 
 // A Name represents an XML name (Local) annotated
 // with a name space identifier (Space).
@@ -73,17 +71,13 @@ func copy(b []byte) []byte {
        return b1;
 }
 
-func (c CharData) Copy() CharData {
-       return CharData(copy(c));
-}
+func (c CharData) Copy() CharData      { return CharData(copy(c)) }
 
 // A Comment represents an XML comment of the form <!--comment-->.
 // The bytes do not include the <!-- and --> comment markers.
 type Comment []byte
 
-func (c Comment) Copy() Comment {
-       return Comment(copy(c));
-}
+func (c Comment) Copy() Comment        { return Comment(copy(c)) }
 
 // A ProcInst represents an XML processing instruction of the form <?target inst?>
 type ProcInst struct {
@@ -100,9 +94,7 @@ func (p ProcInst) Copy() ProcInst {
 // The bytes do not include the <! and > markers.
 type Directive []byte
 
-func (d Directive) Copy() Directive {
-       return Directive(copy(d));
-}
+func (d Directive) Copy() Directive    { return Directive(copy(d)) }
 
 type readByter interface {
        ReadByte() (b byte, err os.Error);
index e8a2a8769ad241fd6386758c8f590afd63c43c0c..8b0fda60a50e8806f3a98840d98a447af9d5ff7d 100644 (file)
@@ -116,9 +116,7 @@ func (r *stringReader) ReadByte() (b byte, err os.Error) {
        return;
 }
 
-func StringReader(s string) io.Reader {
-       return &stringReader{s, 0};
-}
+func StringReader(s string) io.Reader  { return &stringReader{s, 0} }
 
 func TestRawToken(t *testing.T) {
        p := NewParser(StringReader(testInput));