summaryrefslogtreecommitdiff
path: root/src/pkg/template
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-02-25 16:01:29 -0800
committerRuss Cox <rsc@golang.org>2010-02-25 16:01:29 -0800
commit454796815f7f2e0e614b999f9cc1ef0e3e093b78 (patch)
treea0a5f67e4a643d3bdadd4e28cee9b0900401b62d /src/pkg/template
parent975cc91983c054595b22502d7b9271a3d3cb828e (diff)
downloadgolang-454796815f7f2e0e614b999f9cc1ef0e3e093b78.tar.gz
strings: delete Runes, Bytes
gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench delete unused imports R=r CC=golang-dev http://codereview.appspot.com/224062
Diffstat (limited to 'src/pkg/template')
-rw-r--r--src/pkg/template/format.go11
-rw-r--r--src/pkg/template/template.go6
-rw-r--r--src/pkg/template/template_test.go3
3 files changed, 9 insertions, 11 deletions
diff --git a/src/pkg/template/format.go b/src/pkg/template/format.go
index dd49b1bb5..717dcbdbb 100644
--- a/src/pkg/template/format.go
+++ b/src/pkg/template/format.go
@@ -10,7 +10,6 @@ import (
"bytes"
"fmt"
"io"
- "strings"
)
// StringFormatter formats into the default string representation.
@@ -26,11 +25,11 @@ func StringFormatter(w io.Writer, value interface{}, format string) {
}
var (
- esc_quot = strings.Bytes("&#34;") // shorter than "&quot;"
- esc_apos = strings.Bytes("&#39;") // shorter than "&apos;"
- esc_amp = strings.Bytes("&amp;")
- esc_lt = strings.Bytes("&lt;")
- esc_gt = strings.Bytes("&gt;")
+ esc_quot = []byte("&#34;") // shorter than "&quot;"
+ esc_apos = []byte("&#39;") // shorter than "&apos;"
+ esc_amp = []byte("&amp;")
+ esc_lt = []byte("&lt;")
+ esc_gt = []byte("&gt;")
)
// HTMLEscape writes to w the properly escaped HTML equivalent
diff --git a/src/pkg/template/template.go b/src/pkg/template/template.go
index c32a742b8..40b9f640b 100644
--- a/src/pkg/template/template.go
+++ b/src/pkg/template/template.go
@@ -915,7 +915,7 @@ func (t *Template) Parse(s string) os.Error {
if !validDelim(t.ldelim) || !validDelim(t.rdelim) {
return &Error{1, fmt.Sprintf("bad delimiter strings %q %q", t.ldelim, t.rdelim)}
}
- t.buf = strings.Bytes(s)
+ t.buf = []byte(s)
t.p = 0
t.linenum = 1
t.parse()
@@ -942,8 +942,8 @@ func (t *Template) Execute(data interface{}, wr io.Writer) os.Error {
// delimiters are very rarely invalid and Parse has the necessary
// error-handling interface already.
func (t *Template) SetDelims(left, right string) {
- t.ldelim = strings.Bytes(left)
- t.rdelim = strings.Bytes(right)
+ t.ldelim = []byte(left)
+ t.rdelim = []byte(right)
}
// Parse creates a Template with default parameters (such as {} for
diff --git a/src/pkg/template/template_test.go b/src/pkg/template/template_test.go
index 460a3a4b1..a7c34ebee 100644
--- a/src/pkg/template/template_test.go
+++ b/src/pkg/template/template_test.go
@@ -9,7 +9,6 @@ import (
"container/vector"
"fmt"
"io"
- "strings"
"testing"
)
@@ -397,7 +396,7 @@ func TestAll(t *testing.T) {
s.stringmap = make(map[string]string)
s.stringmap["stringkey1"] = "stringresult" // the same value so repeated section is order-independent
s.stringmap["stringkey2"] = "stringresult"
- s.bytes = strings.Bytes("hello")
+ s.bytes = []byte("hello")
s.iface = []int{1, 2, 3}
var buf bytes.Buffer