Fix lint errors in testsharder
Change-Id: I41e2e4d2bac3d60ae0448f17182f3cc0d54952f0
diff --git a/testsharder/environment.go b/testsharder/environment.go
index 7be663e..83851e5 100644
--- a/testsharder/environment.go
+++ b/testsharder/environment.go
@@ -2,12 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// The GN environments specified by test authors in the Fuchsia source
-// correspond directly to the Environment struct defined here.
-//
-// Note that by "platforms" we mean a specific group of dimension sets which
-// correspond to the currently available test platforms supported by the
-// infrastructure.
package testsharder
import (
@@ -20,6 +14,8 @@
)
// Environment describes the full environment a test requires.
+// The GN environments specified by test authors in the Fuchsia source
+// correspond directly to the Environment struct defined here.
type Environment struct {
// Dimensions gives the Swarming dimensions a test wishes to target.
Dimensions DimensionSet `json:"dimensions"`
@@ -92,6 +88,9 @@
// LoadPlatforms loads the list of test platforms specified as a JSON list
// produced by a build, given the root of the build directory.
+// Note that by "platforms" we mean a specific group of dimension sets which
+// correspond to the currently available test platforms supported by the
+// infrastructure.
func LoadPlatforms(fuchsiaBuildDir string) ([]DimensionSet, error) {
platformManifestPath := filepath.Join(fuchsiaBuildDir, build.PlatformManifestName)
bytes, err := ioutil.ReadFile(platformManifestPath)
diff --git a/testsharder/mode.go b/testsharder/mode.go
index e87b93b..088cb90 100644
--- a/testsharder/mode.go
+++ b/testsharder/mode.go
@@ -1,6 +1,7 @@
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package testsharder
import (
diff --git a/testsharder/shard.go b/testsharder/shard.go
index 8362ee8..fb7b159 100644
--- a/testsharder/shard.go
+++ b/testsharder/shard.go
@@ -1,6 +1,7 @@
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package testsharder
import (
@@ -73,8 +74,8 @@
return shards
}
-// Appends new shards to shards where each new shard contains one test repeated
-// multiple times according to the specifications in multipliers.
+// MultiplyShards appends new shards to shards where each new shard contains one test
+// repeated multiple times according to the specifications in multipliers.
func MultiplyShards(shards []*Shard, multipliers []TestModifier) ([]*Shard, error) {
multipliersFound := make(map[TestModifier]bool)
for _, shard := range shards {
@@ -139,9 +140,9 @@
return false
}
seen := make(map[string]int)
- for i, _ := range s {
- seen[s[i]] += 1
- seen[t[i]] -= 1
+ for i := range s {
+ seen[s[i]]++
+ seen[t[i]]--
}
for _, v := range seen {
if v != 0 {
diff --git a/testsharder/test_modifier.go b/testsharder/test_modifier.go
index fa3b9c0..36d8a59 100644
--- a/testsharder/test_modifier.go
+++ b/testsharder/test_modifier.go
@@ -1,6 +1,7 @@
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package testsharder
import (
@@ -33,7 +34,7 @@
return nil, err
}
- for i, _ := range specs {
+ for i := range specs {
if specs[i].Target == "" {
return nil, fmt.Errorf("A test spec's target must have a non-empty name")
}
diff --git a/testsharder/test_spec.go b/testsharder/test_spec.go
index 9417401..087ae10 100644
--- a/testsharder/test_spec.go
+++ b/testsharder/test_spec.go
@@ -1,6 +1,7 @@
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package testsharder
import (
@@ -126,7 +127,7 @@
return nil, err
}
- for i, _ := range specs {
+ for i := range specs {
if specs[i].Path == "" {
specs[i].Path = specs[i].Location
}