Skip to content

Commit

Permalink
Cleanup _merge_embed
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbarsky authored and fmeum committed Aug 16, 2024
1 parent c8a7ebc commit aecc793
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,18 @@ def _merge_embed(source, embed):
source["x_defs"].update(s.x_defs)
source["gc_goopts"] = source["gc_goopts"] + s.gc_goopts
source["runfiles"] = source["runfiles"].merge(s.runfiles)
if s.cgo and source["cgo"]:
fail("multiple libraries with cgo enabled")
source["cgo"] = source["cgo"] or s.cgo
source["cdeps"] = source["cdeps"] or s.cdeps
source["cppopts"] = source["cppopts"] or s.cppopts
source["copts"] = source["copts"] or s.copts
source["cxxopts"] = source["cxxopts"] or s.cxxopts
source["clinkopts"] = source["clinkopts"] or s.clinkopts
source["cgo_exports"] = source["cgo_exports"] + s.cgo_exports

if s.cgo:
if source["cgo"]:
fail("multiple libraries with cgo enabled")
source["cgo"] = s.cgo
source["cdeps"] = s.cdeps
source["cppopts"] = s.cppopts
source["copts"] = s.copts
source["cxxopts"] = s.cxxopts
source["clinkopts"] = s.clinkopts

def _dedup_archives(archives):
"""Returns a list of archives without duplicate import paths.
Expand Down Expand Up @@ -259,9 +261,7 @@ def _library_to_source(go, attr, library, coverage_instrumented):
srcs = attr_srcs + generated_srcs
embedsrcs = [f for t in getattr(attr, "embedsrcs", []) for f in as_iterable(t.files)]
attr_deps = getattr(attr, "deps", [])
generated_deps = getattr(library, "deps", [])
deps = attr_deps + generated_deps
deps = [get_archive(dep) for dep in deps]
deps = [get_archive(dep) for dep in attr_deps]
source = {
"library": library,
"mode": go.mode,
Expand Down

0 comments on commit aecc793

Please sign in to comment.