Skip to content

Commit

Permalink
Remove get_nogo from context
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbarsky authored and fmeum committed Aug 11, 2024
1 parent 3b9a4bc commit 424a9a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 10 additions & 4 deletions go/private/actions/archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ load(
"//go/private:common.bzl",
"as_tuple",
)
load(
"//go/private:context.bzl",
"get_nogo",
)
load(
"//go/private:mode.bzl",
"LINKMODE_C_ARCHIVE",
Expand Down Expand Up @@ -59,14 +63,16 @@ def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_d
# store export information for compiling dependent packages separately
out_export = go.declare_file(go, name = source.library.name, ext = pre_ext + ".x")
out_cgo_export_h = None # set if cgo used in c-shared or c-archive mode
out_facts = None
out_nogo_log = None
out_nogo_validation = None
nogo = go.get_nogo(go)

nogo = get_nogo(go)
if nogo:
out_facts = go.declare_file(go, name = source.library.name, ext = pre_ext + ".facts")
out_nogo_log = go.declare_file(go, name = source.library.name, ext = pre_ext + ".nogo.log")
out_nogo_validation = go.declare_file(go, name = source.library.name, ext = pre_ext + ".nogo")
else:
out_facts = None
out_nogo_log = None
out_nogo_validation = None

direct = [get_archive(dep) for dep in source.deps]

Expand Down
5 changes: 2 additions & 3 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ def _matches_scopes(label, scopes):
return True
return False

def _get_nogo(go):
def get_nogo(go):
"""Returns the nogo file for this target, if enabled and in scope."""
label = go._ctx.label
label = go.label
if _matches_scopes(label, NOGO_INCLUDES) and not _matches_scopes(label, NOGO_EXCLUDES):
return go.nogo
else:
Expand Down Expand Up @@ -604,7 +604,6 @@ def go_context(ctx, attr = None):
library_to_source = _library_to_source,
declare_file = _declare_file,
declare_directory = _declare_directory,
get_nogo = _get_nogo,

# Private
# TODO: All uses of this should be removed
Expand Down

0 comments on commit 424a9a4

Please sign in to comment.