]> Cypherpunks repositories - gostls13.git/commitdiff
use []byte("abc") in place of []byte{'a', 'b', 'c'}
authorRuss Cox <rsc@golang.org>
Fri, 26 Feb 2010 00:43:43 +0000 (16:43 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 26 Feb 2010 00:43:43 +0000 (16:43 -0800)
R=gri
CC=golang-dev
https://golang.org/cl/223059

src/pkg/asn1/asn1_test.go
src/pkg/fmt/print.go
src/pkg/go/ast/filter.go
src/pkg/go/scanner/scanner.go

index bb380ca0b885e926ad29fab51efc4e6220b43667..f488663ba077469c861fc19e6f69c153f7bc831d 100644 (file)
@@ -276,7 +276,7 @@ var unmarshalTestData []unmarshalTest = []unmarshalTest{
        unmarshalTest{[]byte{0x02, 0x01, 0x10}, newInt(16)},
        unmarshalTest{[]byte{0x13, 0x04, 't', 'e', 's', 't'}, newString("test")},
        unmarshalTest{[]byte{0x16, 0x04, 't', 'e', 's', 't'}, newString("test")},
-       unmarshalTest{[]byte{0x16, 0x04, 't', 'e', 's', 't'}, &RawValue{0, 22, false, []byte{'t', 'e', 's', 't'}}},
+       unmarshalTest{[]byte{0x16, 0x04, 't', 'e', 's', 't'}, &RawValue{0, 22, false, []byte("test")}},
        unmarshalTest{[]byte{0x04, 0x04, 1, 2, 3, 4}, &RawValue{0, 4, false, []byte{1, 2, 3, 4}}},
        unmarshalTest{[]byte{0x30, 0x03, 0x81, 0x01, 0x01}, &TestContextSpecificTags{1}},
        unmarshalTest{[]byte{0x30, 0x08, 0xa1, 0x03, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}, &TestContextSpecificTags2{1, 2}},
index ffe187a3138e6822edf4368b39fa0d0f90e8ce8a..ecb8adbc37a80cd70fbb9a73b93e79571b2fce14 100644 (file)
@@ -87,15 +87,15 @@ import (
 // Some constants in the form of bytes, to avoid string overhead.
 // Needlessly fastidious, I suppose.
 var (
-       trueBytes       = []byte{'t', 'r', 'u', 'e'}
-       falseBytes      = []byte{'f', 'a', 'l', 's', 'e'}
-       commaSpaceBytes = []byte{',', ' '}
-       nilAngleBytes   = []byte{'<', 'n', 'i', 'l', '>'}
-       nilParenBytes   = []byte{'(', 'n', 'i', 'l', ')'}
-       nilBytes        = []byte{'n', 'i', 'l'}
-       mapBytes        = []byte{'m', 'a', 'p', '['}
-       missingBytes    = []byte{'m', 'i', 's', 's', 'i', 'n', 'g'}
-       extraBytes      = []byte{'?', '(', 'e', 'x', 't', 'r', 'a', ' '}
+       trueBytes       = []byte("true")
+       falseBytes      = []byte("false")
+       commaSpaceBytes = []byte(", ")
+       nilAngleBytes   = []byte("<nil>")
+       nilParenBytes   = []byte("(nil)")
+       nilBytes        = []byte("nil")
+       mapBytes        = []byte("map[")
+       missingBytes    = []byte("missing")
+       extraBytes      = []byte("?(extra ")
 )
 
 // State represents the printer state passed to custom formatters.
index bad1a58b41b38127059ad1101a9b4c508bc1deed..2646ea886bbf7b590efebe89292b8d64241194c7 100644 (file)
@@ -192,7 +192,7 @@ func PackageExports(pkg *Package) bool {
 // separator is an empty //-style comment that is interspersed between
 // different comment groups when they are concatenated into a single group
 //
-var separator = &Comment{noPos, []byte{'/', '/'}}
+var separator = &Comment{noPos, []byte("//")}
 
 
 // MergePackageFiles creates a file AST by merging the ASTs of the
index a59212011e5b85667fca56b77c4f48fb34d66001..dc2f35939ae657f64240b7b410b2eff99aff83c8 100644 (file)
@@ -145,7 +145,7 @@ func (S *Scanner) expect(ch int) {
 }
 
 
-var prefix = []byte{'l', 'i', 'n', 'e', ' '} // "line "
+var prefix = []byte("line ")
 
 func (S *Scanner) scanComment(pos token.Position) {
        // first '/' already consumed