cosmetic changes
Test: m nothing
Bug: N/A
Change-Id: Ia74a09a6ee42560562e2e1a15e972860e77a5724
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 8834c11..33b67ab 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -938,12 +938,12 @@
// Use host platform, which is currently hardcoded to be x86_64.
arch = "x86_64"
}
- os := key.configKey.osType.Name
- if len(os) == 0 || os == "common_os" || os == "linux_glibc" {
+ osName := key.configKey.osType.Name
+ if len(osName) == 0 || osName == "common_os" || osName == "linux_glibc" {
// Use host OS, which is currently hardcoded to be linux.
- os = "linux"
+ osName = "linux"
}
- return arch + "|" + os
+ return arch + "|" + osName
}
func GetConfigKey(ctx BaseModuleContext) configKey {
diff --git a/bazel/aquery.go b/bazel/aquery.go
index 5e4ebf8..6829698 100644
--- a/bazel/aquery.go
+++ b/bazel/aquery.go
@@ -167,7 +167,7 @@
// Map middleman artifact ContentHash to input artifact depset ID.
// Middleman artifacts are treated as "substitute" artifacts for mixed builds. For example,
- // if we find a middleman action which has outputs [foo, bar], and output [baz_middleman], then,
+ // if we find a middleman action which has inputs [foo, bar], and output [baz_middleman], then,
// for each other action which has input [baz_middleman], we add [foo, bar] to the inputs for
// that action instead.
middlemanIdToDepsetIds := map[artifactId][]depsetId{}
@@ -348,7 +348,7 @@
if prevEntry, hasKey := depsetsByHash[aqueryDepset.ContentHash]; hasKey {
// Two depsets collide on hash. Ensure that their contents are identical.
if !reflect.DeepEqual(aqueryDepset, prevEntry) {
- return nil, nil, fmt.Errorf("Two different depsets have the same hash: %v, %v", prevEntry, aqueryDepset)
+ return nil, nil, fmt.Errorf("two different depsets have the same hash: %v, %v", prevEntry, aqueryDepset)
}
} else {
depsetsByHash[aqueryDepset.ContentHash] = aqueryDepset
diff --git a/bazel/aquery_test.go b/bazel/aquery_test.go
index c9c8909..cf51b39 100644
--- a/bazel/aquery_test.go
+++ b/bazel/aquery_test.go
@@ -224,7 +224,7 @@
}]
}`
actualbuildStatements, actualDepsets, _ := AqueryBuildStatements([]byte(inputString))
- expectedBuildStatements := []BuildStatement{}
+ var expectedBuildStatements []BuildStatement
for _, arch := range []string{"arm", "arm64", "x86", "x86_64"} {
expectedBuildStatements = append(expectedBuildStatements,
BuildStatement{
@@ -235,7 +235,7 @@
fmt.Sprintf("bazel-out/sourceroot/k8-fastbuild/bin/bionic/libc/syscalls-%s.S", arch),
},
Env: []KeyValuePair{
- KeyValuePair{Key: "PATH", Value: "/bin:/usr/bin:/usr/local/bin"},
+ {Key: "PATH", Value: "/bin:/usr/bin:/usr/local/bin"},
},
Mnemonic: "Genrule",
})
@@ -747,7 +747,7 @@
actualbuildStatements, actualDepsets, _ := AqueryBuildStatements([]byte(inputString))
expectedBuildStatements := []BuildStatement{
- BuildStatement{
+ {
Command: "/bin/bash -c 'touch bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_out'",
OutputPaths: []string{"bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_out"},
Mnemonic: "Action",
@@ -758,7 +758,7 @@
// Inputs for the action are test_{i} from 1 to 20, and test_root. These inputs
// are given via a deep depset, but the depset is flattened when returned as a
// BuildStatement slice.
- expectedFlattenedInputs := []string{}
+ var expectedFlattenedInputs []string
for i := 1; i < 20; i++ {
expectedFlattenedInputs = append(expectedFlattenedInputs, fmt.Sprintf("bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_%d", i))
}
@@ -876,7 +876,7 @@
for _, depset := range allDepsets {
depsetsByHash[depset.ContentHash] = depset
}
- result := []string{}
+ var result []string
for _, depsetId := range depsetHashesToFlatten {
result = append(result, flattenDepset(depsetId, depsetsByHash)...)
}
@@ -886,7 +886,7 @@
// Returns the contents of a given depset in post order.
func flattenDepset(depsetHashToFlatten string, allDepsets map[string]AqueryDepset) []string {
depset := allDepsets[depsetHashToFlatten]
- result := []string{}
+ var result []string
for _, depsetId := range depset.TransitiveDepSetHashes {
result = append(result, flattenDepset(depsetId, allDepsets)...)
}
@@ -958,7 +958,7 @@
}
expectedBuildStatements := []BuildStatement{
- BuildStatement{
+ {
Command: "mkdir -p one/symlink_subdir && " +
"rm -f one/symlink_subdir/symlink && " +
"ln -sf $PWD/one/file_subdir/file one/symlink_subdir/symlink",
@@ -1022,7 +1022,7 @@
}
expectedBuildStatements := []BuildStatement{
- BuildStatement{
+ {
Command: "mkdir -p 'one/symlink subdir' && " +
"rm -f 'one/symlink subdir/symlink' && " +
"ln -sf $PWD/'one/file subdir/file' 'one/symlink subdir/symlink'",
@@ -1154,7 +1154,7 @@
}
expectedBuildStatements := []BuildStatement{
- BuildStatement{
+ {
Command: "/bin/bash -c 'echo \"Test template substitutions: abcd, python3\" | sed \"s/\\\\\\\\n/\\\\n/g\" > template_file && " +
"chmod a+x template_file'",
OutputPaths: []string{"template_file"},
@@ -1320,14 +1320,14 @@
}
expectedBuildStatements := []BuildStatement{
- BuildStatement{
+ {
Command: "/bin/bash -c 'echo \"Test template substitutions: abcd, python3\" | sed \"s/\\\\\\\\n/\\\\n/g\" > python_binary && " +
"chmod a+x python_binary'",
InputPaths: []string{"python_binary.zip"},
OutputPaths: []string{"python_binary"},
Mnemonic: "TemplateExpand",
},
- BuildStatement{
+ {
Command: "../bazel_tools/tools/zip/zipper/zipper cC python_binary.zip __main__.py=bazel-out/k8-fastbuild/bin/python_binary.temp " +
"__init__.py= runfiles/__main__/__init__.py= runfiles/__main__/python_binary.py=python_binary.py && " +
"../bazel_tools/tools/zip/zipper/zipper x python_binary.zip -d python_binary.runfiles && ln -sf runfiles/__main__ python_binary.runfiles",