Skip to content

Commit

Permalink
Remove mode from GoArchive (#4028)
Browse files Browse the repository at this point in the history
**What type of PR is this?**
Cleanup

**What does this PR do? Why is it needed?**
Looks like we can use the mode from the `source` instead and reduce the
chance of inconsistencies

**Which issues(s) does this PR fix?**

Fixes #

**Other notes for review**
  • Loading branch information
dzbarsky authored Aug 11, 2024
1 parent 0f88f8c commit bfd99a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion go/private/actions/archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,4 @@ def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_d
cgo_deps = depset(transitive = [cgo_deps] + [a.cgo_deps for a in direct]),
cgo_exports = cgo_exports,
runfiles = runfiles,
mode = go.mode,
)
10 changes: 5 additions & 5 deletions go/private/tools/path.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ load(
"GoArchive",
"GoPath",
"effective_importpath_pkgpath",
"get_archive",
)

def _go_path_impl(ctx):
Expand All @@ -35,10 +34,11 @@ def _go_path_impl(ctx):
# package may also appear in different modes.
mode_to_deps = {}
for dep in ctx.attr.deps:
archive = get_archive(dep)
if archive.mode not in mode_to_deps:
mode_to_deps[archive.mode] = []
mode_to_deps[archive.mode].append(archive)
archive = dep[GoArchive]
mode = archive.source.mode
if mode not in mode_to_deps:
mode_to_deps[mode] = []
mode_to_deps[mode].append(archive)
mode_to_archive = {}
for mode, archives in mode_to_deps.items():
direct = [a.data for a in archives]
Expand Down
4 changes: 0 additions & 4 deletions go/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ which is available through the :param:`data` field.
+--------------------------------+-----------------------------------------------------------------+
| The files needed to run anything that includes this library. |
+--------------------------------+-----------------------------------------------------------------+
| :param:`mode` | :type:`Mode` |
+--------------------------------+-----------------------------------------------------------------+
| The mode this archive was compiled in. |
+--------------------------------+-----------------------------------------------------------------+

GoPath
~~~~~~
Expand Down

0 comments on commit bfd99a6

Please sign in to comment.