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
2nd set of files.
R=rsc
CC=golang-dev
https://golang.org/cl/179067
diff --git a/src/pkg/flag/flag_test.go b/src/pkg/flag/flag_test.go
index 0acfc2f..d6e642b 100644
--- a/src/pkg/flag/flag_test.go
+++ b/src/pkg/flag/flag_test.go
@@ -5,35 +5,35 @@
package flag_test
import (
- . "flag";
- "testing";
+ . "flag"
+ "testing"
)
var (
- test_bool = Bool("test_bool", false, "bool value");
- test_int = Int("test_int", 0, "int value");
- test_int64 = Int64("test_int64", 0, "int64 value");
- test_uint = Uint("test_uint", 0, "uint value");
- test_uint64 = Uint64("test_uint64", 0, "uint64 value");
- test_string = String("test_string", "0", "string value");
- test_float = Float("test_float", 0, "float value");
- test_float64 = Float("test_float64", 0, "float64 value");
+ test_bool = Bool("test_bool", false, "bool value")
+ test_int = Int("test_int", 0, "int value")
+ test_int64 = Int64("test_int64", 0, "int64 value")
+ test_uint = Uint("test_uint", 0, "uint value")
+ test_uint64 = Uint64("test_uint64", 0, "uint64 value")
+ test_string = String("test_string", "0", "string value")
+ test_float = Float("test_float", 0, "float value")
+ test_float64 = Float("test_float64", 0, "float64 value")
)
func boolString(s string) string {
if s == "0" {
return "false"
}
- return "true";
+ return "true"
}
func TestEverything(t *testing.T) {
- m := make(map[string]*Flag);
- desired := "0";
+ m := make(map[string]*Flag)
+ desired := "0"
visitor := func(f *Flag) {
if len(f.Name) > 5 && f.Name[0:5] == "test_" {
- m[f.Name] = f;
- ok := false;
+ m[f.Name] = f
+ ok := false
switch {
case f.Value.String() == desired:
ok = true
@@ -44,35 +44,35 @@
t.Error("Visit: bad value", f.Value.String(), "for", f.Name)
}
}
- };
- VisitAll(visitor);
+ }
+ VisitAll(visitor)
if len(m) != 8 {
- t.Error("VisitAll misses some flags");
+ t.Error("VisitAll misses some flags")
for k, v := range m {
t.Log(k, *v)
}
}
- m = make(map[string]*Flag);
- Visit(visitor);
+ m = make(map[string]*Flag)
+ Visit(visitor)
if len(m) != 0 {
- t.Errorf("Visit sees unset flags");
+ t.Errorf("Visit sees unset flags")
for k, v := range m {
t.Log(k, *v)
}
}
// Now set all flags
- Set("test_bool", "true");
- Set("test_int", "1");
- Set("test_int64", "1");
- Set("test_uint", "1");
- Set("test_uint64", "1");
- Set("test_string", "1");
- Set("test_float", "1");
- Set("test_float64", "1");
- desired = "1";
- Visit(visitor);
+ Set("test_bool", "true")
+ Set("test_int", "1")
+ Set("test_int64", "1")
+ Set("test_uint", "1")
+ Set("test_uint64", "1")
+ Set("test_string", "1")
+ Set("test_float", "1")
+ Set("test_float64", "1")
+ desired = "1"
+ Visit(visitor)
if len(m) != 8 {
- t.Error("Visit fails after set");
+ t.Error("Visit fails after set")
for k, v := range m {
t.Log(k, *v)
}