mirror of
https://github.com/golang/go
synced 2024-11-18 11:24:41 -07:00
cmd/dist: use strings.Builder
Change-Id: I56bd5d6b1333a96339340e5af5e6470cc7fb11a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/428287 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
47faad111f
commit
866fbb67d0
11
src/cmd/dist/buildgo.go
vendored
11
src/cmd/dist/buildgo.go
vendored
@ -5,7 +5,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -28,7 +27,7 @@ import (
|
|||||||
// but we also write cmd/cgo/zdefaultcc.go
|
// but we also write cmd/cgo/zdefaultcc.go
|
||||||
func mkzdefaultcc(dir, file string) {
|
func mkzdefaultcc(dir, file string) {
|
||||||
if strings.Contains(file, filepath.FromSlash("go/internal/cfg")) {
|
if strings.Contains(file, filepath.FromSlash("go/internal/cfg")) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
||||||
fmt.Fprintln(&buf)
|
fmt.Fprintln(&buf)
|
||||||
fmt.Fprintf(&buf, "package cfg\n")
|
fmt.Fprintf(&buf, "package cfg\n")
|
||||||
@ -40,7 +39,7 @@ func mkzdefaultcc(dir, file string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
||||||
fmt.Fprintln(&buf)
|
fmt.Fprintln(&buf)
|
||||||
fmt.Fprintf(&buf, "package main\n")
|
fmt.Fprintf(&buf, "package main\n")
|
||||||
@ -52,7 +51,7 @@ func mkzdefaultcc(dir, file string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func defaultCCFunc(name string, defaultcc map[string]string) string {
|
func defaultCCFunc(name string, defaultcc map[string]string) string {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
|
|
||||||
fmt.Fprintf(&buf, "func %s(goos, goarch string) string {\n", name)
|
fmt.Fprintf(&buf, "func %s(goos, goarch string) string {\n", name)
|
||||||
fmt.Fprintf(&buf, "\tswitch goos+`/`+goarch {\n")
|
fmt.Fprintf(&buf, "\tswitch goos+`/`+goarch {\n")
|
||||||
@ -82,7 +81,7 @@ func mkzosarch(dir, file string) {
|
|||||||
}
|
}
|
||||||
sort.Strings(list)
|
sort.Strings(list)
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n\n")
|
||||||
fmt.Fprintf(&buf, "package cfg\n\n")
|
fmt.Fprintf(&buf, "package cfg\n\n")
|
||||||
fmt.Fprintf(&buf, "var OSArchSupportsCgo = map[string]bool{\n")
|
fmt.Fprintf(&buf, "var OSArchSupportsCgo = map[string]bool{\n")
|
||||||
@ -110,7 +109,7 @@ func mkzcgo(dir, file string) {
|
|||||||
}
|
}
|
||||||
sort.Strings(list)
|
sort.Strings(list)
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
||||||
fmt.Fprintln(&buf)
|
fmt.Fprintln(&buf)
|
||||||
fmt.Fprintf(&buf, "package build\n")
|
fmt.Fprintf(&buf, "package build\n")
|
||||||
|
8
src/cmd/dist/buildruntime.go
vendored
8
src/cmd/dist/buildruntime.go
vendored
@ -5,8 +5,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -19,7 +19,7 @@ import (
|
|||||||
//
|
//
|
||||||
// (Nothing right now!)
|
// (Nothing right now!)
|
||||||
func mkzversion(dir, file string) {
|
func mkzversion(dir, file string) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
||||||
fmt.Fprintln(&buf)
|
fmt.Fprintln(&buf)
|
||||||
fmt.Fprintf(&buf, "package sys\n")
|
fmt.Fprintf(&buf, "package sys\n")
|
||||||
@ -46,7 +46,7 @@ func mkzversion(dir, file string) {
|
|||||||
// This is more useful than having it default to generating objects for the
|
// This is more useful than having it default to generating objects for the
|
||||||
// original target (in this example, a Mac).
|
// original target (in this example, a Mac).
|
||||||
func mkbuildcfg(file string) {
|
func mkbuildcfg(file string) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
||||||
fmt.Fprintln(&buf)
|
fmt.Fprintln(&buf)
|
||||||
fmt.Fprintf(&buf, "package buildcfg\n")
|
fmt.Fprintf(&buf, "package buildcfg\n")
|
||||||
@ -75,7 +75,7 @@ func mkbuildcfg(file string) {
|
|||||||
//
|
//
|
||||||
// (Nothing right now!)
|
// (Nothing right now!)
|
||||||
func mkobjabi(file string) {
|
func mkobjabi(file string) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
|
||||||
fmt.Fprintln(&buf)
|
fmt.Fprintln(&buf)
|
||||||
fmt.Fprintf(&buf, "package objabi\n")
|
fmt.Fprintf(&buf, "package objabi\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user