Merge "Use string.Builder" into main
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
|||||||
"android/soong/bazel"
|
"android/soong/bazel"
|
||||||
"android/soong/starlark_fmt"
|
"android/soong/starlark_fmt"
|
||||||
"android/soong/ui/metrics/bp2build_metrics_proto"
|
"android/soong/ui/metrics/bp2build_metrics_proto"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/bootstrap"
|
"github.com/google/blueprint/bootstrap"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
@@ -94,16 +95,16 @@ func (targets BazelTargets) sort() {
|
|||||||
// statements (use LoadStatements for that), since the targets are usually not
|
// statements (use LoadStatements for that), since the targets are usually not
|
||||||
// adjacent to the load statements at the top of the BUILD file.
|
// adjacent to the load statements at the top of the BUILD file.
|
||||||
func (targets BazelTargets) String() string {
|
func (targets BazelTargets) String() string {
|
||||||
var res string
|
var res strings.Builder
|
||||||
for i, target := range targets {
|
for i, target := range targets {
|
||||||
if target.ruleClass != "package" {
|
if target.ruleClass != "package" {
|
||||||
res += target.content
|
res.WriteString(target.content)
|
||||||
}
|
}
|
||||||
if i != len(targets)-1 {
|
if i != len(targets)-1 {
|
||||||
res += "\n\n"
|
res.WriteString("\n\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res
|
return res.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadStatements return the string representation of the sorted and deduplicated
|
// LoadStatements return the string representation of the sorted and deduplicated
|
||||||
|
Reference in New Issue
Block a user