From 453d728911a45e4f3dac64299b06ad23e72fdf2a Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Wed, 9 Oct 2024 18:25:27 +0200 Subject: [PATCH] Don't call dict.pop() with named arguments (#1951) **What type of PR is this?** Feature **What package or component does this PR mostly affect?** all **What does this PR do? Why is it needed?** I'm doing some experiments, where I'm trying to parse/analyze some existing Bazel rules using Go Starlark. This seems to be mostly successful, though I am noticing some small breakages. **Which issues(s) does this PR fix?** It fixes an issue where dict.pop() is called with named arguments in a couple of places, even though it's only supposed to be called with positional arguments. **Other notes for review** --- def.bzl | 2 +- internal/bzlmod/go_deps.bzl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/def.bzl b/def.bzl index 5a25bfacb..e5fa09787 100644 --- a/def.bzl +++ b/def.bzl @@ -205,7 +205,7 @@ def _gazelle_kwargs_prepare(name, kwargs): kwargs["extra_args"] = kwargs["args"] kwargs.pop("args") - visibility = kwargs.pop("visibility", default = None) + visibility = kwargs.pop("visibility", None) return name + "-runner", visibility def gazelle(name, **kwargs): diff --git a/internal/bzlmod/go_deps.bzl b/internal/bzlmod/go_deps.bzl index dcd0db37c..eaf17f96f 100644 --- a/internal/bzlmod/go_deps.bzl +++ b/internal/bzlmod/go_deps.bzl @@ -595,8 +595,8 @@ def _go_deps_impl(module_ctx): for path, module in module_resolutions.items(): if hasattr(module, "module_name"): # Do not create a go_repository for a Go module provided by a bazel_dep. - root_module_direct_deps.pop(_repo_name(path), default = None) - root_module_direct_dev_deps.pop(_repo_name(path), default = None) + root_module_direct_deps.pop(_repo_name(path), None) + root_module_direct_dev_deps.pop(_repo_name(path), None) continue if getattr(module_ctx, "is_isolated", False) and path in _SHARED_REPOS: # Do not create a go_repository for a dep shared with the non-isolated instance of