1
0
mirror of https://github.com/golang/go synced 2024-11-22 02:34:40 -07:00

use []byte("abc") in place of []byte{'a', 'b', 'c'}

R=gri
CC=golang-dev
https://golang.org/cl/223059
This commit is contained in:
Russ Cox 2010-02-25 16:43:43 -08:00
parent d177539877
commit 8fbd5f8a82
4 changed files with 12 additions and 12 deletions

View File

@ -276,7 +276,7 @@ var unmarshalTestData []unmarshalTest = []unmarshalTest{
unmarshalTest{[]byte{0x02, 0x01, 0x10}, newInt(16)}, unmarshalTest{[]byte{0x02, 0x01, 0x10}, newInt(16)},
unmarshalTest{[]byte{0x13, 0x04, 't', 'e', 's', 't'}, newString("test")}, 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'}, 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{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, 0x03, 0x81, 0x01, 0x01}, &TestContextSpecificTags{1}},
unmarshalTest{[]byte{0x30, 0x08, 0xa1, 0x03, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}, &TestContextSpecificTags2{1, 2}}, unmarshalTest{[]byte{0x30, 0x08, 0xa1, 0x03, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}, &TestContextSpecificTags2{1, 2}},

View File

@ -87,15 +87,15 @@ import (
// Some constants in the form of bytes, to avoid string overhead. // Some constants in the form of bytes, to avoid string overhead.
// Needlessly fastidious, I suppose. // Needlessly fastidious, I suppose.
var ( var (
trueBytes = []byte{'t', 'r', 'u', 'e'} trueBytes = []byte("true")
falseBytes = []byte{'f', 'a', 'l', 's', 'e'} falseBytes = []byte("false")
commaSpaceBytes = []byte{',', ' '} commaSpaceBytes = []byte(", ")
nilAngleBytes = []byte{'<', 'n', 'i', 'l', '>'} nilAngleBytes = []byte("<nil>")
nilParenBytes = []byte{'(', 'n', 'i', 'l', ')'} nilParenBytes = []byte("(nil)")
nilBytes = []byte{'n', 'i', 'l'} nilBytes = []byte("nil")
mapBytes = []byte{'m', 'a', 'p', '['} mapBytes = []byte("map[")
missingBytes = []byte{'m', 'i', 's', 's', 'i', 'n', 'g'} missingBytes = []byte("missing")
extraBytes = []byte{'?', '(', 'e', 'x', 't', 'r', 'a', ' '} extraBytes = []byte("?(extra ")
) )
// State represents the printer state passed to custom formatters. // State represents the printer state passed to custom formatters.

View File

@ -192,7 +192,7 @@ func PackageExports(pkg *Package) bool {
// separator is an empty //-style comment that is interspersed between // separator is an empty //-style comment that is interspersed between
// different comment groups when they are concatenated into a single group // 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 // MergePackageFiles creates a file AST by merging the ASTs of the

View 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) { func (S *Scanner) scanComment(pos token.Position) {
// first '/' already consumed // first '/' already consumed