diff options
author | Russ Cox <rsc@golang.org> | 2010-02-25 16:01:29 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-02-25 16:01:29 -0800 |
commit | 454796815f7f2e0e614b999f9cc1ef0e3e093b78 (patch) | |
tree | a0a5f67e4a643d3bdadd4e28cee9b0900401b62d /src/pkg/template | |
parent | 975cc91983c054595b22502d7b9271a3d3cb828e (diff) | |
download | golang-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.go | 11 | ||||
-rw-r--r-- | src/pkg/template/template.go | 6 | ||||
-rw-r--r-- | src/pkg/template/template_test.go | 3 |
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(""") // shorter than """ - esc_apos = strings.Bytes("'") // shorter than "'" - esc_amp = strings.Bytes("&") - esc_lt = strings.Bytes("<") - esc_gt = strings.Bytes(">") + esc_quot = []byte(""") // shorter than """ + esc_apos = []byte("'") // shorter than "'" + esc_amp = []byte("&") + esc_lt = []byte("<") + esc_gt = []byte(">") ) // 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 |