summaryrefslogtreecommitdiff
path: root/src/pkg/template
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
committerRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
commit828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch)
treefd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/template
parenteb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff)
downloadgolang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz
- fine-tuning of one-line func heuristic (nodes.go)
- 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
Diffstat (limited to 'src/pkg/template')
-rw-r--r--src/pkg/template/template.go8
-rw-r--r--src/pkg/template/template_test.go4
2 files changed, 5 insertions, 7 deletions
diff --git a/src/pkg/template/template.go b/src/pkg/template/template.go
index c647a2d37..728b7a529 100644
--- a/src/pkg/template/template.go
+++ b/src/pkg/template/template.go
@@ -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 {
diff --git a/src/pkg/template/template_test.go b/src/pkg/template/template_test.go
index becfa0f0b..6fbc14726 100644
--- a/src/pkg/template/template_test.go
+++ b/src/pkg/template/template_test.go
@@ -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));
+ };
}