1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
1st set of files.
R=rsc
CC=agl, golang-dev, iant, ken2, r
https://golang.org/cl/180047
diff --git a/misc/cgo/stdio/chain.go b/misc/cgo/stdio/chain.go
index 18c598d..dd5e015 100644
--- a/misc/cgo/stdio/chain.go
+++ b/misc/cgo/stdio/chain.go
@@ -7,9 +7,9 @@
package main
import (
- "runtime";
- "stdio";
- "strconv";
+ "runtime"
+ "stdio"
+ "strconv"
)
const N = 10
@@ -19,25 +19,25 @@
// Keep the links in dedicated operating system
// threads, so that this program tests coordination
// between pthreads and not just goroutines.
- runtime.LockOSThread();
+ runtime.LockOSThread()
for {
- v := <-right;
- stdio.Puts(strconv.Itoa(v));
- left <- 1+v;
+ v := <-right
+ stdio.Puts(strconv.Itoa(v))
+ left <- 1+v
}
}
func main() {
- leftmost := make(chan int);
- var left chan int;
- right := leftmost;
+ leftmost := make(chan int)
+ var left chan int
+ right := leftmost
for i := 0; i < N; i++ {
- left, right = right, make(chan int);
- go link(left, right);
+ left, right = right, make(chan int)
+ go link(left, right)
}
for i := 0; i < R; i++ {
- right <- 0;
- x := <-leftmost;
- stdio.Puts(strconv.Itoa(x));
+ right <- 0
+ x := <-leftmost
+ stdio.Puts(strconv.Itoa(x))
}
}
diff --git a/misc/cgo/stdio/fib.go b/misc/cgo/stdio/fib.go
index 1e2336d..63ae049 100644
--- a/misc/cgo/stdio/fib.go
+++ b/misc/cgo/stdio/fib.go
@@ -10,38 +10,38 @@
package main
import (
- "runtime";
- "stdio";
- "strconv";
+ "runtime"
+ "stdio"
+ "strconv"
)
func fibber(c, out chan int64, i int64) {
// Keep the fibbers in dedicated operating system
// threads, so that this program tests coordination
// between pthreads and not just goroutines.
- runtime.LockOSThread();
+ runtime.LockOSThread()
if i == 0 {
c <- i
}
for {
- j := <-c;
- stdio.Puts(strconv.Itoa64(j));
- out <- j;
- <-out;
- i += j;
- c <- i;
+ j := <-c
+ stdio.Puts(strconv.Itoa64(j))
+ out <- j
+ <-out
+ i += j
+ c <- i
}
}
func main() {
- c := make(chan int64);
- out := make(chan int64);
- go fibber(c, out, 0);
- go fibber(c, out, 1);
- <-out;
+ c := make(chan int64)
+ out := make(chan int64)
+ go fibber(c, out, 0)
+ go fibber(c, out, 1)
+ <-out
for i := 0; i < 90; i++ {
- out <- 1;
- <-out;
+ out <- 1
+ <-out
}
}
diff --git a/misc/cgo/stdio/file.go b/misc/cgo/stdio/file.go
index c8493a0..7d1f222 100644
--- a/misc/cgo/stdio/file.go
+++ b/misc/cgo/stdio/file.go
@@ -35,8 +35,8 @@
*/
func Puts(s string) {
- p := C.CString(s);
- C.puts(p);
- C.free(unsafe.Pointer(p));
- C.fflushstdout();
+ p := C.CString(s)
+ C.puts(p)
+ C.free(unsafe.Pointer(p))
+ C.fflushstdout()
}