depot_tools: Address nits from 14185
Bug: skia:
Change-Id: I9ce019653fa88a860412bf3e740ce10d20e8d909
Reviewed-on: https://skia-review.googlesource.com/14271
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
diff --git a/go/depot_tools/depot_tools.go b/go/depot_tools/depot_tools.go
index d15961b..f24a912 100644
--- a/go/depot_tools/depot_tools.go
+++ b/go/depot_tools/depot_tools.go
@@ -16,7 +16,8 @@
DEPOT_TOOLS_VERSION = "none"
)
-// Sync syncs the depot_tools checkout to DEPOT_TOOLS_VERSION.
+// Sync syncs the depot_tools checkout to DEPOT_TOOLS_VERSION. Returns the
+// location of the checkout or an error.
func Sync(workdir string) (string, error) {
// Clone the repo if necessary.
co, err := git.NewCheckout(common.REPO_DEPOT_TOOLS, workdir)
diff --git a/go/depot_tools/testutils/testutils.go b/go/depot_tools/testutils/testutils.go
index a098f84..5f80fa0 100644
--- a/go/depot_tools/testutils/testutils.go
+++ b/go/depot_tools/testutils/testutils.go
@@ -29,12 +29,6 @@
depotToolsMtx.Lock()
defer depotToolsMtx.Unlock()
- // Sync to a special location.
- workdir := path.Join(os.TempDir(), "sktest_depot_tools")
- if _, err := os.Stat(workdir); err == nil {
- return Sync(t, workdir)
- }
-
// Check the environment. Bots may not have a full Git checkout, so
// just return the dir.
depotTools := os.Getenv("DEPOT_TOOLS")
@@ -45,6 +39,12 @@
sklog.Errorf("DEPOT_TOOLS=%s but dir does not exist!", depotTools)
}
+ // Sync to a special location.
+ workdir := path.Join(os.TempDir(), "sktest_depot_tools")
+ if _, err := os.Stat(workdir); err == nil {
+ return Sync(t, workdir)
+ }
+
// If "gclient" is in PATH, then we know where to get depot_tools.
gclient, err := exec.LookPath("gclient")
if err == nil && gclient != "" {