Skip to content

Commit a87a6cf

Browse files
fmeumjacqueline.lee
authored andcommitted
Reduce number of declared files in emit_stdlib (bazel-contrib#3366)
* The `src` directory is declared, but not passed to downstream rules. It has been declared since cfc58d9, but hasn't been exposed since 3680494 * Instead of writing a new root file, use the existing `pkg` directory.
1 parent bfac04f commit a87a6cf

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

go/private/actions/stdlib.bzl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,11 @@ def _sdk_stdlib(go):
7575

7676
def _build_stdlib(go):
7777
pkg = go.declare_directory(go, path = "pkg")
78-
src = go.declare_directory(go, path = "src")
79-
root_file = go.declare_file(go, path = "ROOT")
8078
args = go.builder_args(go, "stdlib")
81-
args.add("-out", root_file.dirname)
79+
args.add("-out", pkg.dirname)
8280
if go.mode.race:
8381
args.add("-race")
8482
args.add_all(link_mode_args(go.mode))
85-
go.actions.write(root_file, "")
8683
env = go.env
8784
if go.mode.pure:
8885
env.update({"CGO_ENABLED": "0"})
@@ -105,7 +102,7 @@ def _build_stdlib(go):
105102
go.sdk.tools +
106103
[go.sdk.go, go.sdk.package_list, go.sdk.root_file] +
107104
go.crosstool)
108-
outputs = [pkg, src]
105+
outputs = [pkg]
109106
go.actions.run(
110107
inputs = inputs,
111108
outputs = outputs,
@@ -117,5 +114,5 @@ def _build_stdlib(go):
117114
return GoStdLib(
118115
_list_json = _build_stdlib_list_json(go),
119116
libs = [pkg],
120-
root_file = root_file,
117+
root_file = pkg,
121118
)

go/providers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ from GoSDK_, or it may be another library compiled for the target mode.
428428
+--------------------------------+-----------------------------------------------------------------+
429429
| :param:`root_file` | :type:`File` |
430430
+--------------------------------+-----------------------------------------------------------------+
431-
| A file in the standard library root directory. Used to determine ``GOROOT``. |
431+
| A file or directory in the standard library root directory. Used to determine ``GOROOT``. |
432432
+--------------------------------+-----------------------------------------------------------------+
433433
| :param:`libs` | :type:`list of File` |
434434
+--------------------------------+-----------------------------------------------------------------+

0 commit comments

Comments
 (0)