diff options
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/cgo/gcc.go | 10 | ||||
| -rw-r--r-- | src/cmd/cgo/out.go | 20 | ||||
| -rw-r--r-- | src/cmd/ebnflint/ebnflint.go | 2 | ||||
| -rw-r--r-- | src/cmd/godoc/godoc.go | 26 | ||||
| -rw-r--r-- | src/cmd/godoc/index.go | 10 | ||||
| -rw-r--r-- | src/cmd/godoc/main.go | 4 | ||||
| -rw-r--r-- | src/cmd/godoc/spec.go | 10 | ||||
| -rw-r--r-- | src/cmd/goyacc/goyacc.go | 108 | ||||
| -rw-r--r-- | src/cmd/hgpatch/main.go | 4 |
9 files changed, 97 insertions, 97 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index f5c33e82c..6e9ba13b7 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -198,7 +198,7 @@ func (p *Prog) gccDebug(stdin []byte) (*dwarf.Data, string) { machine, "-Wall", // many warnings "-Werror", // warnings are errors - "-o"+tmp, // write object to tmp + "-o" + tmp, // write object to tmp "-gdwarf-2", // generate DWARF v2 debugging symbols "-c", // do not link "-xc", // input language is C @@ -515,7 +515,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type { s = ss } s = strings.Join(strings.Split(s, " ", 0), ""); // strip spaces - name := c.Ident("_C_"+s); + name := c.Ident("_C_" + s); c.typedef[name.Value] = t.Go; t.Go = name; } @@ -609,11 +609,11 @@ func (c *typeConv) pad(fld []*ast.Field, size int64) []*ast.Field { // Struct conversion func (c *typeConv) Struct(dt *dwarf.StructType) (expr *ast.StructType, csyntax string, align int64) { csyntax = "struct { "; - fld := make([]*ast.Field, 0, 2*len(dt.Field) + 1); // enough for padding around every field + fld := make([]*ast.Field, 0, 2*len(dt.Field)+1); // enough for padding around every field off := int64(0); for _, f := range dt.Field { if f.ByteOffset > off { - fld = c.pad(fld, f.ByteOffset - off); + fld = c.pad(fld, f.ByteOffset-off); off = f.ByteOffset; } t := c.Type(f.Type); @@ -627,7 +627,7 @@ func (c *typeConv) Struct(dt *dwarf.StructType) (expr *ast.StructType, csyntax s } } if off < dt.ByteSize { - fld = c.pad(fld, dt.ByteSize - off); + fld = c.pad(fld, dt.ByteSize-off); off = dt.ByteSize; } if off != dt.ByteSize { diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 2a62233b7..297ffe40a 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -13,7 +13,7 @@ import ( ) func creat(name string) *os.File { - f, err := os.Open(name, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0666); + f, err := os.Open(name, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, 0666); if err != nil { fatal("%s", err) } @@ -72,7 +72,7 @@ func (p *Prog) writeOutput(srcfile string) { for name, def := range p.Funcdef { // Go func declaration. d := &ast.FuncDecl{ - Name: &ast.Ident{Value: "_C_"+name}, + Name: &ast.Ident{Value: "_C_" + name}, Type: def.Go, }; printer.Fprint(fgo2, d); @@ -92,8 +92,8 @@ func (p *Prog) writeOutput(srcfile string) { off := int64(0); npad := 0; for i, t := range def.Params { - if off % t.Align != 0 { - pad := t.Align - off % t.Align; + if off%t.Align != 0 { + pad := t.Align - off%t.Align; structType += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad); off += pad; npad++; @@ -101,15 +101,15 @@ func (p *Prog) writeOutput(srcfile string) { structType += fmt.Sprintf("\t\t%s p%d;\n", t.C, i); off += t.Size; } - if off % p.PtrSize != 0 { - pad := p.PtrSize - off % p.PtrSize; + if off%p.PtrSize != 0 { + pad := p.PtrSize - off%p.PtrSize; structType += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad); off += pad; npad++; } if t := def.Result; t != nil { - if off % t.Align != 0 { - pad := t.Align - off % t.Align; + if off%t.Align != 0 { + pad := t.Align - off%t.Align; structType += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad); off += pad; npad++; @@ -117,8 +117,8 @@ func (p *Prog) writeOutput(srcfile string) { structType += fmt.Sprintf("\t\t%s r;\n", t.C); off += t.Size; } - if off % p.PtrSize != 0 { - pad := p.PtrSize - off % p.PtrSize; + if off%p.PtrSize != 0 { + pad := p.PtrSize - off%p.PtrSize; structType += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad); off += pad; npad++; diff --git a/src/cmd/ebnflint/ebnflint.go b/src/cmd/ebnflint/ebnflint.go index e013dd030..394e473a8 100644 --- a/src/cmd/ebnflint/ebnflint.go +++ b/src/cmd/ebnflint/ebnflint.go @@ -56,7 +56,7 @@ func extractEBNF(src []byte) []byte { // j = end of EBNF text (or end of source) j := bytes.Index(src[i:len(src)], close); // close marker if j < 0 { - j = len(src)-i + j = len(src) - i } j += i; diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index 10c280e29..de5235673 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -142,7 +142,7 @@ func firstSentence(s string) string { j := -1; // index+1 of first period that is followed by white space prev := 'A'; for k, ch := range s { - k1 := k+1; + k1 := k + 1; if ch == '.' { if i < 0 { i = k1 // first period @@ -208,7 +208,7 @@ func newDirTree(path, name string, depth, maxDepth int) *Directory { if text == "" { // no package documentation yet; take the first found file, err := parser.ParseFile(pathutil.Join(path, d.Name), nil, - parser.ParseComments | parser.PackageClauseOnly); + parser.ParseComments|parser.PackageClauseOnly); if err == nil && // Also accept fakePkgName, so we get synopses for commmands. // Note: This may lead to incorrect results if there is a @@ -338,7 +338,7 @@ func (root *Directory) listing(skipRoot bool) *DirList { // determine number of entries n and maximum height n := 0; - minDepth := 1<<30; // infinity + minDepth := 1 << 30; // infinity maxDepth := 0; for d := range root.iter(skipRoot) { n++; @@ -349,7 +349,7 @@ func (root *Directory) listing(skipRoot bool) *DirList { maxDepth = d.Depth } } - maxHeight := maxDepth-minDepth+1; + maxHeight := maxDepth - minDepth + 1; if n == 0 { return nil @@ -445,7 +445,7 @@ func parse(path string, mode uint) (*ast.File, *parseErrors) { for i, r := range errors { // Should always be true, but check for robustness. if 0 <= r.Pos.Offset && r.Pos.Offset <= len(src) { - errs[i].src = src[offs : r.Pos.Offset]; + errs[i].src = src[offs:r.Pos.Offset]; offs = r.Pos.Offset; } errs[i].line = r.Pos.Line; @@ -669,7 +669,7 @@ func paddingFmt(w io.Writer, x interface{}, format string) { // Template formatter for "time" format. func timeFmt(w io.Writer, x interface{}, format string) { // note: os.Dir.Mtime_ns is in uint64 in ns! - template.HTMLEscape(w, strings.Bytes(time.SecondsToLocalTime(int64(x.(uint64) / 1e9)).String())) + template.HTMLEscape(w, strings.Bytes(time.SecondsToLocalTime(int64(x.(uint64)/1e9)).String())) } @@ -738,7 +738,7 @@ func servePage(c *http.Conn, title, query string, content []byte) { _, ts := fsTree.get(); d := Data{ Title: title, - Timestamp: uint64(ts)*1e9, // timestamp in ns + Timestamp: uint64(ts) * 1e9, // timestamp in ns Query: query, Content: content, }; @@ -801,7 +801,7 @@ func serveParseErrors(c *http.Conn, errors *parseErrors) { if err := parseerrorHTML.Execute(errors, &buf); err != nil { log.Stderrf("parseerrorHTML.Execute: %s", err) } - servePage(c, "Parse errors in source file " + errors.filename, "", buf.Bytes()); + servePage(c, "Parse errors in source file "+errors.filename, "", buf.Bytes()); } @@ -817,7 +817,7 @@ func serveGoSource(c *http.Conn, r *http.Request, path string, styler printer.St writeNode(&buf, prog, true, styler); fmt.Fprintln(&buf, "</pre>"); - servePage(c, "Source file " + r.URL.Path, "", buf.Bytes()); + servePage(c, "Source file "+r.URL.Path, "", buf.Bytes()); } @@ -887,7 +887,7 @@ func serveTextFile(c *http.Conn, r *http.Request, path string) { template.HTMLEscape(&buf, src); fmt.Fprintln(&buf, "</pre>"); - servePage(c, "Text file " + path, "", buf.Bytes()); + servePage(c, "Text file "+path, "", buf.Bytes()); } @@ -907,7 +907,7 @@ func serveDirectory(c *http.Conn, r *http.Request, path string) { log.Stderrf("dirlistHTML.Execute: %s", err) } - servePage(c, "Directory " + path, "", buf.Bytes()); + servePage(c, "Directory "+path, "", buf.Bytes()); } @@ -1150,11 +1150,11 @@ func indexer() { stop := time.Nanoseconds(); searchIndex.set(index); if *verbose { - secs := float64((stop-start)/1e6)/1e3; + secs := float64((stop-start)/1e6) / 1e3; nwords, nspots := index.Size(); log.Stderrf("index updated (%gs, %d unique words, %d spots)", secs, nwords, nspots); } } - time.Sleep(1*60e9); // try once a minute + time.Sleep(1 * 60e9); // try once a minute } } diff --git a/src/cmd/godoc/index.go b/src/cmd/godoc/index.go index 02ce545b1..9ee9e77b4 100644 --- a/src/cmd/godoc/index.go +++ b/src/cmd/godoc/index.go @@ -127,7 +127,7 @@ func init() { // makeSpotInfo makes a SpotInfo. func makeSpotInfo(kind SpotKind, lori int, isIndex bool) SpotInfo { // encode lori: bits [4..32) - x := SpotInfo(lori)<<4; + x := SpotInfo(lori) << 4; if int(x>>4) != lori { // lori value doesn't fit - since snippet indices are // most certainly always smaller then 1<<28, this can @@ -135,7 +135,7 @@ func makeSpotInfo(kind SpotKind, lori int, isIndex bool) SpotInfo { x = 0 } // encode kind: bits [1..4) - x |= SpotInfo(kind)<<1; + x |= SpotInfo(kind) << 1; // encode isIndex: bit 0 if isIndex { x |= 1 @@ -144,8 +144,8 @@ func makeSpotInfo(kind SpotKind, lori int, isIndex bool) SpotInfo { } -func (x SpotInfo) Kind() SpotKind { return SpotKind(x>>1&7) } -func (x SpotInfo) Lori() int { return int(x>>4) } +func (x SpotInfo) Kind() SpotKind { return SpotKind(x >> 1 & 7) } +func (x SpotInfo) Lori() int { return int(x >> 4) } func (x SpotInfo) IsIndex() bool { return x&1 != 0 } @@ -255,7 +255,7 @@ func newFileRun(h0 *RunList, i, j int) interface{} { // reduce the list of Spots into a list of KindRuns var h1 RunList; - h1.Vector.Init(j-i); + h1.Vector.Init(j - i); k := 0; for ; i < j; i++ { h1.Set(k, h0.At(i).(Spot).Info); diff --git a/src/cmd/godoc/main.go b/src/cmd/godoc/main.go index ee4f19650..a59bd8028 100644 --- a/src/cmd/godoc/main.go +++ b/src/cmd/godoc/main.go @@ -117,7 +117,7 @@ func dosync(c *http.Conn, r *http.Request) { syncDelay.set(*syncMin) // revert to regular sync schedule default: // sync failed because of an error - back off exponentially, but try at least once a day - syncDelay.backoff(24*60) + syncDelay.backoff(24 * 60) } } @@ -194,7 +194,7 @@ func main() { if *verbose { log.Stderrf("next sync in %dmin", delay.(int)) } - time.Sleep(int64(delay.(int))*60e9); + time.Sleep(int64(delay.(int)) * 60e9); } }(); } diff --git a/src/cmd/godoc/spec.go b/src/cmd/godoc/spec.go index a863a16cd..15ce2fb9e 100644 --- a/src/cmd/godoc/spec.go +++ b/src/cmd/godoc/spec.go @@ -32,7 +32,7 @@ type ebnfParser struct { func (p *ebnfParser) flush() { - p.out.Write(p.src[p.prev : p.pos.Offset]); + p.out.Write(p.src[p.prev:p.pos.Offset]); p.prev = p.pos.Offset; } @@ -60,7 +60,7 @@ func (p *ebnfParser) errorExpected(pos token.Position, msg string) { // make the error message more specific msg += ", found '" + p.tok.String() + "'"; if p.tok.IsLiteral() { - msg += " "+string(p.lit) + msg += " " + string(p.lit) } } p.Error(pos, msg); @@ -70,7 +70,7 @@ func (p *ebnfParser) errorExpected(pos token.Position, msg string) { func (p *ebnfParser) expect(tok token.Token) token.Position { pos := p.pos; if p.tok != tok { - p.errorExpected(pos, "'" + tok.String() + "'") + p.errorExpected(pos, "'"+tok.String()+"'") } p.next(); // make progress in any case return pos; @@ -178,14 +178,14 @@ func linkify(out io.Writer, src []byte) { // i: beginning of EBNF text (or end of source) i := bytes.Index(src, openTag); if i < 0 { - i = n-len(openTag) + i = n - len(openTag) } i += len(openTag); // j: end of EBNF text (or end of source) j := bytes.Index(src[i:n], closeTag); // close marker if j < 0 { - j = n-i + j = n - i } j += i; diff --git a/src/cmd/goyacc/goyacc.go b/src/cmd/goyacc/goyacc.go index 983052cf2..11c7553ed 100644 --- a/src/cmd/goyacc/goyacc.go +++ b/src/cmd/goyacc/goyacc.go @@ -99,7 +99,7 @@ const ( // flags for a rule having an action, and being reduced const ( - ACTFLAG = 1<<(iota+2); + ACTFLAG = 1 << (iota + 2); REDFLAG; ) @@ -108,7 +108,7 @@ const YYFLAG = -1000 // parse tokens const ( - IDENTIFIER = PRIVATE+iota; + IDENTIFIER = PRIVATE + iota; MARK; TERM; LEFT; @@ -131,18 +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 @@ -318,7 +318,7 @@ func main() { setup(); // initialize and read productions - tbitset = (ntokens+32)/32; + tbitset = (ntokens + 32) / 32; cpres(); // make table of which productions yield a given nonterminal cempty(); // make a table of which nonterminals can match the empty string cpfir(); // make a table of firsts of nonterminals @@ -430,7 +430,7 @@ outer: case LEFT, BINARY, RIGHT, TERM: // nonzero means new prec. and assoc. - lev := t-TERM; + lev := t - TERM; if lev != 0 { i++ } @@ -699,7 +699,7 @@ outer: func moreprod() { n := len(prdptr); if nprod >= n { - nn := n+PRODINC; + nn := n + PRODINC; aprod := make([][]int, nn); alevprd := make([]int, nn); arlines := make([]int, nn); @@ -732,13 +732,13 @@ func defin(nt int, s string) int { nontrst = anontrst; } nontrst[nnonter] = Symb{s, 0}; - return NTBASE+nnonter; + return NTBASE + nnonter; } // must be a token ntokens++; if ntokens >= len(tokset) { - nn := ntokens+SYMINC; + nn := ntokens + SYMINC; atokset := make([]Symb, nn); atoklev := make([]int, nn); @@ -791,9 +791,9 @@ func defin(nt int, s string) int { case c >= '0' && c <= '9': c -= '0' case c >= 'a' && c <= 'f': - c -= 'a'-10 + c -= 'a' - 10 case c >= 'A' && c <= 'F': - c -= 'A'-10 + c -= 'A' - 10 default: error("illegal \\unnnn construction") } @@ -928,7 +928,7 @@ func gettok() int { if tokname == resrv[c].name { if tokflag { fmt.Printf(">>> %%%v %v %v\n", tokname, - resrv[c].value - PRIVATE, lineno) + resrv[c].value-PRIVATE, lineno) } return resrv[c].value; } @@ -936,7 +936,7 @@ func gettok() int { error("invalid escape, or illegal reserved word: %v", tokname); case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - numbval = c-'0'; + numbval = c - '0'; for { c = getrune(finput); if !isdigit(c) { @@ -1027,7 +1027,7 @@ func chfind(t int, s string) int { } for i := 0; i <= nnonter; i++ { if s == nontrst[i].name { - return NTBASE+i + return NTBASE + i } } @@ -1302,7 +1302,7 @@ loop: c = getrune(finput); } ungetrune(finput, c); - j = j*s; + j = j * s; if j >= max { error("Illegal use of $%v", j) } @@ -1485,7 +1485,7 @@ func cpres() { fatfl = 0; // make undefined symbols nonfatal for i := 0; i <= nnonter; i++ { n := 0; - c := i+NTBASE; + c := i + NTBASE; for j := 0; j < nprod; j++ { if prdptr[j][0] == c { curres[n] = prdptr[j][1:len(prdptr[j])]; @@ -1545,7 +1545,7 @@ more: if pempty[prd[0]-NTBASE] != 0 { continue } - np = len(prd)-1; + np = len(prd) - 1; for p = 1; p < np; p++ { if prd[p] >= NTBASE && pempty[prd[p]-NTBASE] == WHOKNOWS { break @@ -1592,7 +1592,7 @@ again: if pempty[prd[0]-NTBASE] != WHOKNOWS { continue } - np = len(prd)-1; + np = len(prd) - 1; for p = 1; p < np; p++ { if prd[p] < NTBASE || pempty[prd[p]-NTBASE] != EMPTY { continue next @@ -1636,7 +1636,7 @@ func cpfir() { // initially fill the sets for s = 0; s < n; s++ { prd = curres[s]; - np = len(prd)-1; + np = len(prd) - 1; for p = 0; p < np; p++ { ch = prd[p]; if ch < NTBASE { @@ -1659,9 +1659,9 @@ func cpfir() { n = len(curres); for s = 0; s < n; s++ { prd = curres[s]; - np = len(prd)-1; + np = len(prd) - 1; for p = 0; p < np; p++ { - ch = prd[p]-NTBASE; + ch = prd[p] - NTBASE; if ch < 0 { break } @@ -1743,7 +1743,7 @@ func stagen() { // do a goto on c putitem(wsets[p].pitem, wsets[p].ws); - for q := p+1; q < cwp; q++ { + for q := p + 1; q < cwp; q++ { // this item contributes to the goto if c == wsets[q].pitem.first { putitem(wsets[q].pitem, wsets[q].ws); @@ -1928,7 +1928,7 @@ func state(c int) int { // sort the items var k, l int; - for k = p1+1; k < p2; k++ { // make k the biggest + for k = p1 + 1; k < p2; k++ { // make k the biggest for l = k; l > p1; l-- { if statemem[l].pitem.prodno < statemem[l-1].pitem.prodno || statemem[l].pitem.prodno == statemem[l-1].pitem.prodno && @@ -1942,7 +1942,7 @@ func state(c int) int { } } - size1 := p2-p1; // size of state + size1 := p2 - p1; // size of state var i int; if c >= NTBASE { @@ -1956,7 +1956,7 @@ look: // get ith state q1 := pstate[i]; q2 := pstate[i+1]; - size2 := q2-q1; + size2 := q2 - q1; if size1 != size2 { continue } @@ -2004,7 +2004,7 @@ look: } tystate[nstate] = MUSTDO; nstate++; - return nstate-1; + return nstate - 1; } func putitem(p Pitem, set Lkset) { @@ -2041,7 +2041,7 @@ func writem(pp Pitem) string { var i int; p := pp.prod; - q := chcopy(nontrst[prdptr[pp.prodno][0]-NTBASE].name)+": "; + q := chcopy(nontrst[prdptr[pp.prodno][0]-NTBASE].name) + ": "; npi := pp.off; pi := aryeq(p, prdptr[pp.prodno]); @@ -2094,7 +2094,7 @@ func apack(p []int, n int) int { p = p[pp : n+1]; // now, find a place for the elements from p to q, inclusive - r := len(amem)-len(p); + r := len(amem) - len(p); nextk: for rr := 0; rr <= r; rr++ { @@ -2131,7 +2131,7 @@ nextk: fmt.Fprintf(foutput, "\n"); } } - return off+rr; + return off + rr; } error("no space in action table"); return 0; @@ -2366,7 +2366,7 @@ func wrstate(i int) { } if tystate[i] == MUSTLOOKAHEAD { // print out empty productions in closure - for u = pstate[i+1]-pstate[i]; u < cwp; u++ { + for u = pstate[i+1] - pstate[i]; u < cwp; u++ { if wsets[u].pitem.first < 0 { fmt.Fprintf(foutput, "\t%v\n", writem(wsets[u].pitem)) } @@ -2447,14 +2447,14 @@ func go2out() { } // best is now the default entry - zzgobest += times-1; + zzgobest += times - 1; n := 0; for j := 0; j < nstate; j++ { if tystate[j] != 0 && tystate[j] != best { n++ } } - goent := make([]int, 2*n + 1); + goent := make([]int, 2*n+1); n = 0; for j := 0; j < nstate; j++ { if tystate[j] != 0 && tystate[j] != best { @@ -2491,10 +2491,10 @@ func go2gen(c int) { work = 0; for i = 0; i < nprod; i++ { // cc is a nonterminal with a goto on c - cc = prdptr[i][1]-NTBASE; + cc = prdptr[i][1] - NTBASE; if cc >= 0 && temp1[cc] != 0 { // thus, the left side of production i does too - cc = prdptr[i][0]-NTBASE; + cc = prdptr[i][0] - NTBASE; if temp1[cc] == 0 { work = 1; temp1[cc] = 1; @@ -2541,7 +2541,7 @@ func hideprod() { nred := 0; levprd[0] = 0; for i := 1; i < nprod; i++ { - if (levprd[i]&REDFLAG) == 0 { + if (levprd[i] & REDFLAG) == 0 { if foutput != nil { fmt.Fprintf(foutput, "Rule not reduced: %v\n", writem(Pitem{prdptr[i], 0, 0, i})) @@ -2549,7 +2549,7 @@ func hideprod() { fmt.Printf("rule %v never reduced\n", writem(Pitem{prdptr[i], 0, 0, i})); nred++; } - levprd[i] = prdptr[i][0]-NTBASE; + levprd[i] = prdptr[i][0] - NTBASE; } if nred != 0 { fmt.Printf("%v rules never reduced\n", nred) @@ -2600,7 +2600,7 @@ func callopt() { // minimum entry index is always 0 v = yypgo[i]; - q = len(v)-1; + q = len(v) - 1; for p = 0; p < q; p += 2 { ggreed[i] += 2; if v[p] > j { @@ -2681,7 +2681,7 @@ func gin(i int) { ggreed[i] = 0; q := yypgo[i]; - nq := len(q)-1; + nq := len(q) - 1; // now, find amem place for it nextgp: @@ -2690,7 +2690,7 @@ nextgp: continue } for r := 0; r < nq; r += 2 { - s = p+q[r]+1; + s = p + q[r] + 1; if s > maxa { maxa = s; if maxa >= ACTSIZE { @@ -2708,7 +2708,7 @@ nextgp: maxa = p } for r := 0; r < nq; r += 2 { - s = p+q[r]+1; + s = p + q[r] + 1; amem[s] = q[r+1]; } pgo[i] = p; @@ -2734,7 +2734,7 @@ nextn: for n := -maxoff; n < ACTSIZE; n++ { flag := 0; for r := 0; r < nq; r += 2 { - s = q[r]+n; + s = q[r] + n; if s < 0 || s > ACTSIZE { continue nextn } @@ -2771,7 +2771,7 @@ nextn: } for r := 0; r < nq; r += 2 { - s = q[r]+n; + s = q[r] + n; if s > maxa { maxa = s } @@ -2813,7 +2813,7 @@ func others() { //yyr2 is the number of rules for each production // for i = 1; i < nprod; i++ { - temp1[i] = len(prdptr[i])-2 + temp1[i] = len(prdptr[i]) - 2 } arout("YYR2", temp1, nprod); @@ -2928,7 +2928,7 @@ func summary() { fmt.Fprintf(foutput, "%v shift/reduce, %v reduce/reduce conflicts reported\n", zzsrconf, zzrrconf); fmt.Fprintf(foutput, "%v working sets used\n", len(wsets)); fmt.Fprintf(foutput, "memory: parser %v/%v\n", memp, ACTSIZE); - fmt.Fprintf(foutput, "%v extra closures\n", zzclose - 2*nstate); + fmt.Fprintf(foutput, "%v extra closures\n", zzclose-2*nstate); fmt.Fprintf(foutput, "%v shift entries, %v exceptions\n", zzacent, zzexcp); fmt.Fprintf(foutput, "%v goto entries\n", zzgoent); fmt.Fprintf(foutput, "%v entries saved by goto default\n", zzgobest); @@ -2976,11 +2976,11 @@ func chcopy(q string) string { j := 0; for i = 0; i < len(q); i++ { if q[i] == '"' { - s += q[j:i]+"\\"; + s += q[j:i] + "\\"; j = i; } } - return s+q[j:i]; + return s + q[j:i]; } func usage() { @@ -2988,9 +2988,9 @@ 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) } @@ -3002,7 +3002,7 @@ func setunion(a, b []int) int { sub := 0; for i := 0; i < tbitset; i++ { x := a[i]; - y := x|b[i]; + y := x | b[i]; a[i] = y; if y != x { sub = 1 @@ -3110,7 +3110,7 @@ func open(s string) *bufio.Reader { } func create(s string, m int) *bufio.Writer { - fo, err := os.Open(s, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, m); + fo, err := os.Open(s, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, m); if err != nil { error("error opening %v: %v", s, err) } diff --git a/src/cmd/hgpatch/main.go b/src/cmd/hgpatch/main.go index 53dbfa1f5..96b5ef496 100644 --- a/src/cmd/hgpatch/main.go +++ b/src/cmd/hgpatch/main.go @@ -152,7 +152,7 @@ func main() { changed[o.Dst] = 1; } if o.Mode != 0 { - chk(os.Chmod(o.Dst, o.Mode & 0755)); + chk(os.Chmod(o.Dst, o.Mode&0755)); undoRevert(o.Dst); changed[o.Dst] = 1; } @@ -211,7 +211,7 @@ func mkdirAll(path string, perm int) os.Error { } if j > 0 { - err = mkdirAll(path[0 : j-1], perm); + err = mkdirAll(path[0:j-1], perm); if err != nil { return err } |
