[build/go] Depend on sysroot runtime libraries

//build/unification/lib's sysroot and toolchain targets are split
into different files as the toolchain-related targets are not
available in ASAN builds.

Fixed: 55686

Change-Id: I81728056d040e41019d3f2893c1ae9112ae4cea7
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/405381
Commit-Queue: Ghanan Gowripalan <ghanan@google.com>
Reviewed-by: P.Y. Laligand <pylaligand@google.com>
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 39c8b95..f032ffa 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -1121,7 +1121,7 @@
         if (!defined(data_deps)) {
           data_deps = []
         }
-        data_deps += [ "//build/unification/lib:sysroot" ]
+        data_deps += [ "//build/unification/lib/sysroot" ]
         should_add_toolchain_deps = true
         if (defined(configs)) {
           # Do not add runtime dependencies if compiling statically.
@@ -1132,7 +1132,7 @@
           }
         }
         if (should_add_toolchain_deps) {
-          data_deps += [ "//build/unification/lib:toolchain" ]
+          data_deps += [ "//build/unification/lib/toolchain" ]
         }
       }
     }
diff --git a/build/go/go_build.gni b/build/go/go_build.gni
index fba4aa7..48f3b03 100644
--- a/build/go/go_build.gni
+++ b/build/go/go_build.gni
@@ -278,6 +278,7 @@
 
       if (is_fuchsia) {
         deps += [
+          "//build/unification/lib/sysroot",
           "//sdk/lib/fdio",
           "//third_party/go:go_runtime",
         ]
diff --git a/build/unification/lib/sysroot/BUILD.gn b/build/unification/lib/sysroot/BUILD.gn
new file mode 100644
index 0000000..c5f0bec
--- /dev/null
+++ b/build/unification/lib/sysroot/BUILD.gn
@@ -0,0 +1,10 @@
+# Copyright 2020 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.
+
+import("//build/unification/lib/zircon_runtime_library.gni")
+
+# The sysroot currently only provides a single library, libc.
+zircon_runtime_library("sysroot") {
+  library = "c"
+}
diff --git a/build/unification/lib/BUILD.gn b/build/unification/lib/toolchain/BUILD.gn
similarity index 90%
rename from build/unification/lib/BUILD.gn
rename to build/unification/lib/toolchain/BUILD.gn
index e339c96..595eaa4 100644
--- a/build/unification/lib/BUILD.gn
+++ b/build/unification/lib/toolchain/BUILD.gn
@@ -4,11 +4,6 @@
 
 import("//build/unification/lib/zircon_runtime_library.gni")
 
-# The sysroot currently only provides a single library, libc.
-zircon_runtime_library("sysroot") {
-  library = "c"
-}
-
 compiler_libs = [
   "libcpp.so.2",
   "libcppabi.so.1",
diff --git a/build/unification/lib/zircon_runtime_library.gni b/build/unification/lib/zircon_runtime_library.gni
index 507ae2d..a12cf64 100644
--- a/build/unification/lib/zircon_runtime_library.gni
+++ b/build/unification/lib/zircon_runtime_library.gni
@@ -58,7 +58,9 @@
     ]
   }
 
-  metadata_entries = exec_script("format_metadata.py", format_args, "json")
+  metadata_entries = exec_script("//build/unification/lib/format_metadata.py",
+                                 format_args,
+                                 "json")
 
   group(target_name) {
     metadata = {