summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/cgo/gcc.go4
-rw-r--r--src/cmd/ebnflint/ebnflint.go5
-rw-r--r--src/cmd/godoc/godoc.go26
-rw-r--r--src/cmd/godoc/index.go2
-rwxr-xr-xsrc/cmd/godoc/snippet.go3
-rw-r--r--src/cmd/godoc/spec.go5
6 files changed, 21 insertions, 24 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 01c483684..fc2da37c1 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -724,7 +724,7 @@ func (c *typeConv) Opaque(n int64) ast.Expr {
func (c *typeConv) intExpr(n int64) ast.Expr {
return &ast.BasicLit{
Kind: token.INT,
- Value: strings.Bytes(strconv.Itoa64(n)),
+ Value: []byte(strconv.Itoa64(n)),
}
}
@@ -755,7 +755,7 @@ func (c *typeConv) Struct(dt *dwarf.StructType) (expr *ast.StructType, csyntax s
used[f.Name] = true
}
for cid, goid := range ident {
- if token.Lookup(strings.Bytes(goid)).IsKeyword() {
+ if token.Lookup([]byte(goid)).IsKeyword() {
// Avoid keyword
goid = "_" + goid
diff --git a/src/cmd/ebnflint/ebnflint.go b/src/cmd/ebnflint/ebnflint.go
index 9d391249d..3dfa71f07 100644
--- a/src/cmd/ebnflint/ebnflint.go
+++ b/src/cmd/ebnflint/ebnflint.go
@@ -13,7 +13,6 @@ import (
"io/ioutil"
"os"
"path"
- "strings"
)
@@ -29,8 +28,8 @@ func usage() {
// Markers around EBNF sections in .html files
var (
- open = strings.Bytes(`<pre class="ebnf">`)
- close = strings.Bytes(`</pre>`)
+ open = []byte(`<pre class="ebnf">`)
+ close = []byte(`</pre>`)
)
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
index 98cac945f..29792d58f 100644
--- a/src/cmd/godoc/godoc.go
+++ b/src/cmd/godoc/godoc.go
@@ -152,7 +152,7 @@ func pkgName(filename string) string {
func htmlEscape(s string) string {
var buf bytes.Buffer
- template.HTMLEscape(&buf, strings.Bytes(s))
+ template.HTMLEscape(&buf, []byte(s))
return buf.String()
}
@@ -476,7 +476,7 @@ func (s *Styler) BasicLit(x *ast.BasicLit) (text []byte, tag printer.HTMLTag) {
func (s *Styler) Ident(id *ast.Ident) (text []byte, tag printer.HTMLTag) {
- text = strings.Bytes(id.Name())
+ text = []byte(id.Name())
if s.highlight == id.Name() {
tag = printer.HTMLTag{"<span class=highlight>", "</span>"}
}
@@ -485,7 +485,7 @@ func (s *Styler) Ident(id *ast.Ident) (text []byte, tag printer.HTMLTag) {
func (s *Styler) Token(tok token.Token) (text []byte, tag printer.HTMLTag) {
- text = strings.Bytes(tok.String())
+ text = []byte(tok.String())
return
}
@@ -493,7 +493,7 @@ func (s *Styler) Token(tok token.Token) (text []byte, tag printer.HTMLTag) {
// ----------------------------------------------------------------------------
// Tab conversion
-var spaces = strings.Bytes(" ") // 16 spaces seems like a good number
+var spaces = []byte(" ") // 16 spaces seems like a good number
const (
indenting = iota
@@ -595,7 +595,7 @@ func writeAny(w io.Writer, x interface{}, html bool) {
case []byte:
writeText(w, v, html)
case string:
- writeText(w, strings.Bytes(v), html)
+ writeText(w, []byte(v), html)
case ast.Decl, ast.Expr, ast.Stmt, *ast.File:
writeNode(w, x, html, &defaultStyler)
default:
@@ -674,13 +674,13 @@ func urlFmt(w io.Writer, x interface{}, format string) {
if strings.HasPrefix(relpath, "src/pkg/") {
relpath = relpath[len("src/pkg/"):]
}
- template.HTMLEscape(w, strings.Bytes(pkgHandler.pattern+relpath))
+ template.HTMLEscape(w, []byte(pkgHandler.pattern+relpath))
case "url-src":
- template.HTMLEscape(w, strings.Bytes("/"+relpath))
+ template.HTMLEscape(w, []byte("/"+relpath))
case "url-pos":
// line id's in html-printed source are of the
// form "L%d" where %d stands for the line number
- template.HTMLEscape(w, strings.Bytes("/"+relpath))
+ template.HTMLEscape(w, []byte("/"+relpath))
fmt.Fprintf(w, "#L%d", line)
}
}
@@ -742,7 +742,7 @@ func paddingFmt(w io.Writer, x interface{}, format string) {
// Template formatter for "time" format.
func timeFmt(w io.Writer, x interface{}, format string) {
// note: os.Dir.Mtime_ns is in uint64 in ns!
- template.HTMLEscape(w, strings.Bytes(time.SecondsToLocalTime(int64(x.(uint64)/1e9)).String()))
+ template.HTMLEscape(w, []byte(time.SecondsToLocalTime(int64(x.(uint64)/1e9)).String()))
}
@@ -757,7 +757,7 @@ func dirslashFmt(w io.Writer, x interface{}, format string) {
// Template formatter for "localname" format.
func localnameFmt(w io.Writer, x interface{}, format string) {
_, localname := pathutil.Split(x.(string))
- template.HTMLEscape(w, strings.Bytes(localname))
+ template.HTMLEscape(w, []byte(localname))
}
@@ -852,8 +852,8 @@ func serveText(c *http.Conn, text []byte) {
// Files
var (
- tagBegin = strings.Bytes("<!--")
- tagEnd = strings.Bytes("-->")
+ tagBegin = []byte("<!--")
+ tagEnd = []byte("-->")
)
// commentText returns the text of the first HTML comment in src.
@@ -878,7 +878,7 @@ func serveHTMLDoc(c *http.Conn, r *http.Request, abspath, relpath string) {
// if it begins with "<!DOCTYPE " assume it is standalone
// html that doesn't need the template wrapping.
- if bytes.HasPrefix(src, strings.Bytes("<!DOCTYPE ")) {
+ if bytes.HasPrefix(src, []byte("<!DOCTYPE ")) {
c.Write(src)
return
}
diff --git a/src/cmd/godoc/index.go b/src/cmd/godoc/index.go
index dcad67a95..01ec29878 100644
--- a/src/cmd/godoc/index.go
+++ b/src/cmd/godoc/index.go
@@ -696,7 +696,7 @@ func (x *Index) LookupWord(w string) (match *LookupResult, alt *AltWords) {
func isIdentifier(s string) bool {
var S scanner.Scanner
- S.Init("", strings.Bytes(s), nil, 0)
+ S.Init("", []byte(s), nil, 0)
if _, tok, _ := S.Scan(); tok == token.IDENT {
_, tok, _ := S.Scan()
return tok == token.EOF
diff --git a/src/cmd/godoc/snippet.go b/src/cmd/godoc/snippet.go
index 102878dc5..d8fb19533 100755
--- a/src/cmd/godoc/snippet.go
+++ b/src/cmd/godoc/snippet.go
@@ -14,7 +14,6 @@ import (
"go/ast"
"go/printer"
"fmt"
- "strings"
)
@@ -36,7 +35,7 @@ func (s *snippetStyler) LineTag(line int) (text []uint8, tag printer.HTMLTag) {
func (s *snippetStyler) Ident(id *ast.Ident) (text []byte, tag printer.HTMLTag) {
- text = strings.Bytes(id.Name())
+ text = []byte(id.Name())
if s.highlight == id {
tag = printer.HTMLTag{"<span class=highlight>", "</span>"}
}
diff --git a/src/cmd/godoc/spec.go b/src/cmd/godoc/spec.go
index 15f3cba20..2298fae2c 100644
--- a/src/cmd/godoc/spec.go
+++ b/src/cmd/godoc/spec.go
@@ -16,7 +16,6 @@ import (
"go/scanner"
"go/token"
"io"
- "strings"
)
@@ -166,8 +165,8 @@ func (p *ebnfParser) parse(out io.Writer, src []byte) {
// Markers around EBNF sections
var (
- openTag = strings.Bytes(`<pre class="ebnf">`)
- closeTag = strings.Bytes(`</pre>`)
+ openTag = []byte(`<pre class="ebnf">`)
+ closeTag = []byte(`</pre>`)
)