treewide: format repo with buildifier

Change-Id: Ia7aebeb7bba5b119c9157d1ad805cc477bcbb68a
Reviewed-on: https://review.monogon.dev/c/monogon/+/3774
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/cli/metroctl/BUILD.bazel b/metropolis/cli/metroctl/BUILD.bazel
index 6d9f32a..f4c5c15 100644
--- a/metropolis/cli/metroctl/BUILD.bazel
+++ b/metropolis/cli/metroctl/BUILD.bazel
@@ -56,7 +56,7 @@
         "@com_github_adrg_xdg//:xdg",
         "@com_github_schollz_progressbar_v3//:progressbar",
         "@com_github_spf13_cobra//:cobra",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
         "@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
         "@io_k8s_client_go//pkg/apis/clientauthentication/v1:clientauthentication",
         "@io_k8s_utils//ptr",
diff --git a/metropolis/cli/metroctl/defs.bzl b/metropolis/cli/metroctl/defs.bzl
index ce75195..dbebca2 100644
--- a/metropolis/cli/metroctl/defs.bzl
+++ b/metropolis/cli/metroctl/defs.bzl
@@ -1,12 +1,15 @@
-BuildKindProvider = provider(fields = ['type'])
+BuildKindInfo = provider(
+    "Build kind for userspace tools",
+    fields = ["type"],
+)
 
 def _impl(ctx):
-    values = ['full', 'lite'] 
+    values = ["full", "lite"]
     value = ctx.build_setting_value
     if value not in values:
         fail(str(ctx.label) + " build setting allowed to take values {full, lite} but was set to " + value)
 
-    return BuildKindProvider(type = value)
+    return BuildKindInfo(type = value)
 
 buildkind = rule(
     implementation = _impl,
diff --git a/metropolis/cli/metroctl/test/BUILD.bazel b/metropolis/cli/metroctl/test/BUILD.bazel
index f849949..8f58a9a 100644
--- a/metropolis/cli/metroctl/test/BUILD.bazel
+++ b/metropolis/cli/metroctl/test/BUILD.bazel
@@ -16,6 +16,6 @@
         "//metropolis/version",
         "//osbase/cmd",
         "//version",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
     ],
 )
diff --git a/metropolis/cli/takeover/e2e/BUILD.bazel b/metropolis/cli/takeover/e2e/BUILD.bazel
index 81ff44a..1f96fe2 100644
--- a/metropolis/cli/takeover/e2e/BUILD.bazel
+++ b/metropolis/cli/takeover/e2e/BUILD.bazel
@@ -24,7 +24,7 @@
         "//metropolis/test/launch",
         "//osbase/fat32",
         "//osbase/freeport",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
         "@org_golang_google_protobuf//proto",
         "@org_golang_x_crypto//ssh",
         "@org_golang_x_sys//unix",
diff --git a/metropolis/handbook/defs.bzl b/metropolis/handbook/defs.bzl
index ffd0b84..2ad44f3 100644
--- a/metropolis/handbook/defs.bzl
+++ b/metropolis/handbook/defs.bzl
@@ -21,7 +21,7 @@
     # SUMMARY.md and the parent directory of that is the root.
     summary = None
     for f in ctx.files.srcs:
-        if not f.path.endswith('/SUMMARY.md'):
+        if not f.path.endswith("/SUMMARY.md"):
             continue
         if summary != None:
             fail("More then one SUMMARY.md provided.")
@@ -41,8 +41,8 @@
     # Then we will need to prepend:
     #   ../../../../../../../
     # To get back to execroot/.
-    prepend = len(out_book_toml.path.split('/')) - 1
-    src_dir_path = ('../' * prepend) + summary.dirname
+    prepend = len(out_book_toml.path.split("/")) - 1
+    src_dir_path = ("../" * prepend) + summary.dirname
 
     # Generate book.toml.
     # Bazel does not have a toml library. We abuse JSON encoding to get
@@ -58,27 +58,29 @@
     ]
     ctx.actions.write(
         output = out_book_toml,
-        content = "\n".join(book_toml_contents)
+        content = "\n".join(book_toml_contents),
     )
 
     out_dir = ctx.actions.declare_directory(ctx.attr.name)
+
     # We also have to prepend the out dir path, for the same reasons for which
     # we prepend src_dir_path above.
-    out_dir_path = ('../' * prepend) + out_dir.path
+    out_dir_path = ("../" * prepend) + out_dir.path
     ctx.actions.run(
         executable = ctx.executable._mdbook,
         arguments = [
             "build",
-            "-d", out_dir_path,
+            "-d",
+            out_dir_path,
             out_book_toml.dirname,
         ],
-        inputs = ctx.files.srcs + [ out_book_toml ],
-        outputs = [ out_dir ],
+        inputs = ctx.files.srcs + [out_book_toml],
+        outputs = [out_dir],
     )
     return [
         DefaultInfo(
             files = depset([out_dir]),
-        )
+        ),
     ]
 
 mdbook_html = rule(
@@ -100,11 +102,10 @@
             allow_files = True,
             doc = "The sources of the generated book. Exaclty one file must be named SUMMARY.md, and that file's location will be used to determine the root of the book sources.",
         ),
-
         "_mdbook": attr.label(
             doc = "The mdbook tool.",
             executable = True,
-            cfg = "host",
+            cfg = "exec",
             default = "@crate_index//:mdbook__mdbook",
         ),
     },
diff --git a/metropolis/installer/BUILD.bazel b/metropolis/installer/BUILD.bazel
index 4fcd58c..61cf7b6 100644
--- a/metropolis/installer/BUILD.bazel
+++ b/metropolis/installer/BUILD.bazel
@@ -1,7 +1,7 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
 load("//osbase/build:def.bzl", "node_initramfs")
-load("//osbase/build/genosrelease:defs.bzl", "os_release")
 load("//osbase/build:efi.bzl", "efi_unified_kernel_image")
+load("//osbase/build/genosrelease:defs.bzl", "os_release")
 
 go_library(
     name = "installer_lib",
diff --git a/metropolis/installer/test/BUILD.bazel b/metropolis/installer/test/BUILD.bazel
index 468d452..7390cf6 100644
--- a/metropolis/installer/test/BUILD.bazel
+++ b/metropolis/installer/test/BUILD.bazel
@@ -27,7 +27,7 @@
         "@com_github_diskfs_go_diskfs//:go-diskfs",
         "@com_github_diskfs_go_diskfs//disk",
         "@com_github_diskfs_go_diskfs//partition/gpt",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
     ],
 )
 
diff --git a/metropolis/installer/test/testos/BUILD.bazel b/metropolis/installer/test/testos/BUILD.bazel
index d1ae0df..c41fbee 100644
--- a/metropolis/installer/test/testos/BUILD.bazel
+++ b/metropolis/installer/test/testos/BUILD.bazel
@@ -1,7 +1,7 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("@rules_pkg//:pkg.bzl", "pkg_zip")
 load("//osbase/build:def.bzl", "erofs_image", "verity_image")
 load("//osbase/build:efi.bzl", "efi_unified_kernel_image")
-load("@rules_pkg//:pkg.bzl", "pkg_zip")
 
 erofs_image(
     name = "rootfs",
diff --git a/metropolis/node/core/abloader/spec/BUILD.bazel b/metropolis/node/core/abloader/spec/BUILD.bazel
index 54d96cc..cfe921f 100644
--- a/metropolis/node/core/abloader/spec/BUILD.bazel
+++ b/metropolis/node/core/abloader/spec/BUILD.bazel
@@ -1,7 +1,7 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
-load("@rules_rust//proto/prost:defs.bzl", "rust_prost_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@rules_rust//proto/prost:defs.bzl", "rust_prost_library")
 
 proto_library(
     name = "abloader_proto",
diff --git a/metropolis/node/core/bios_bootcode/genlogo/def.bzl b/metropolis/node/core/bios_bootcode/genlogo/def.bzl
index 11a56cd..5db80ee 100644
--- a/metropolis/node/core/bios_bootcode/genlogo/def.bzl
+++ b/metropolis/node/core/bios_bootcode/genlogo/def.bzl
@@ -16,8 +16,6 @@
         files = depset([output]),
     )
 
-    pass
-
 gen_logo = rule(
     implementation = _build_logo_impl,
     attrs = {
diff --git a/metropolis/node/core/curator/proto/api/BUILD.bazel b/metropolis/node/core/curator/proto/api/BUILD.bazel
index dbc1cbf..e7315f2 100644
--- a/metropolis/node/core/curator/proto/api/BUILD.bazel
+++ b/metropolis/node/core/curator/proto/api/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "api_proto",
diff --git a/metropolis/node/core/curator/proto/private/BUILD.bazel b/metropolis/node/core/curator/proto/private/BUILD.bazel
index 035f007..9a1ad4b 100644
--- a/metropolis/node/core/curator/proto/private/BUILD.bazel
+++ b/metropolis/node/core/curator/proto/private/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "private_proto",
diff --git a/metropolis/node/core/metrics/BUILD.bazel b/metropolis/node/core/metrics/BUILD.bazel
index 9383afb..893a6c4 100644
--- a/metropolis/node/core/metrics/BUILD.bazel
+++ b/metropolis/node/core/metrics/BUILD.bazel
@@ -38,6 +38,6 @@
         "//osbase/freeport",
         "//osbase/supervisor",
         "@com_zx2c4_golang_wireguard_wgctrl//wgtypes",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
     ],
 )
diff --git a/metropolis/node/core/update/e2e/BUILD.bazel b/metropolis/node/core/update/e2e/BUILD.bazel
index 71be003..3f6aa66 100644
--- a/metropolis/node/core/update/e2e/BUILD.bazel
+++ b/metropolis/node/core/update/e2e/BUILD.bazel
@@ -28,6 +28,6 @@
         "//osbase/blkio",
         "//osbase/blockdev",
         "//osbase/build/mkimage/osimage",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
     ],
 )
diff --git a/metropolis/node/core/update/e2e/testos/testos.bzl b/metropolis/node/core/update/e2e/testos/testos.bzl
index 9db31c2..a019bc9 100644
--- a/metropolis/node/core/update/e2e/testos/testos.bzl
+++ b/metropolis/node/core/update/e2e/testos/testos.bzl
@@ -1,8 +1,8 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+load("@rules_pkg//:mappings.bzl", "pkg_files")
+load("@rules_pkg//:pkg.bzl", "pkg_zip")
 load("//osbase/build:def.bzl", "erofs_image", "verity_image")
 load("//osbase/build:efi.bzl", "efi_unified_kernel_image")
-load("@rules_pkg//:pkg.bzl", "pkg_zip")
-load("@rules_pkg//:mappings.bzl", "pkg_files")
 
 # Macro for generating multiple TestOS instances to check if the updater works.
 def testos(variant):
diff --git a/metropolis/proto/BUILD.bazel b/metropolis/proto/BUILD.bazel
index 42aecdc..d3a0f89 100644
--- a/metropolis/proto/BUILD.bazel
+++ b/metropolis/proto/BUILD.bazel
@@ -1,4 +1,4 @@
-load("@rules_proto_grpc_buf//:defs.bzl", "buf_proto_breaking_test", "buf_proto_lint_test")
+load("@rules_proto_grpc_buf//:defs.bzl", "buf_proto_lint_test")
 load("@rules_proto_grpc_doc//:defs.bzl", "doc_html_compile")
 
 doc_html_compile(
diff --git a/metropolis/proto/api/BUILD.bazel b/metropolis/proto/api/BUILD.bazel
index 294dcb8..b1e84e6 100644
--- a/metropolis/proto/api/BUILD.bazel
+++ b/metropolis/proto/api/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "api_proto",
diff --git a/metropolis/proto/common/BUILD.bazel b/metropolis/proto/common/BUILD.bazel
index 41a5405..031a27c 100644
--- a/metropolis/proto/common/BUILD.bazel
+++ b/metropolis/proto/common/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "common_proto",
diff --git a/metropolis/proto/ext/BUILD.bazel b/metropolis/proto/ext/BUILD.bazel
index aeb6d69..01112b0 100644
--- a/metropolis/proto/ext/BUILD.bazel
+++ b/metropolis/proto/ext/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "ext_proto",
diff --git a/metropolis/proto/private/BUILD.bazel b/metropolis/proto/private/BUILD.bazel
index 1729ce9..e15ddf9 100644
--- a/metropolis/proto/private/BUILD.bazel
+++ b/metropolis/proto/private/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "private_proto",
diff --git a/metropolis/test/e2e/suites/core/BUILD.bazel b/metropolis/test/e2e/suites/core/BUILD.bazel
index a8c90ad..662ed28 100644
--- a/metropolis/test/e2e/suites/core/BUILD.bazel
+++ b/metropolis/test/e2e/suites/core/BUILD.bazel
@@ -24,7 +24,7 @@
         "//metropolis/test/localregistry",
         "//metropolis/test/util",
         "//osbase/test/launch",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
         "@org_golang_google_grpc//:grpc",
     ],
 )
diff --git a/metropolis/test/e2e/suites/ha/BUILD.bazel b/metropolis/test/e2e/suites/ha/BUILD.bazel
index 3d9c688..cc792a3 100644
--- a/metropolis/test/e2e/suites/ha/BUILD.bazel
+++ b/metropolis/test/e2e/suites/ha/BUILD.bazel
@@ -20,6 +20,6 @@
         "//metropolis/test/localregistry",
         "//metropolis/test/util",
         "//osbase/test/launch",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
     ],
 )
diff --git a/metropolis/test/e2e/suites/kubernetes/BUILD.bazel b/metropolis/test/e2e/suites/kubernetes/BUILD.bazel
index 8a2acba..fbfad4d 100644
--- a/metropolis/test/e2e/suites/kubernetes/BUILD.bazel
+++ b/metropolis/test/e2e/suites/kubernetes/BUILD.bazel
@@ -40,7 +40,7 @@
         "//metropolis/test/launch",
         "//metropolis/test/localregistry",
         "//metropolis/test/util",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
         "@io_k8s_api//core/v1:core",
         "@io_k8s_apimachinery//pkg/api/errors",
         "@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
diff --git a/metropolis/test/launch/BUILD.bazel b/metropolis/test/launch/BUILD.bazel
index fca8bbf..fa66e5a 100644
--- a/metropolis/test/launch/BUILD.bazel
+++ b/metropolis/test/launch/BUILD.bazel
@@ -53,7 +53,7 @@
         "//osbase/test/launch",
         "@com_github_cenkalti_backoff_v4//:backoff",
         "@com_github_kballard_go_shellquote//:go-shellquote",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
         "@io_k8s_client_go//kubernetes",
         "@io_k8s_client_go//rest",
         "@io_k8s_utils//ptr",
diff --git a/metropolis/test/launch/cli/launch-cluster/BUILD.bazel b/metropolis/test/launch/cli/launch-cluster/BUILD.bazel
index 250a1b1..5b58b9b 100644
--- a/metropolis/test/launch/cli/launch-cluster/BUILD.bazel
+++ b/metropolis/test/launch/cli/launch-cluster/BUILD.bazel
@@ -1,5 +1,4 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-load("@bazel_skylib//rules:native_binary.bzl", "native_test")
 
 go_library(
     name = "launch-cluster_lib",
@@ -18,7 +17,7 @@
         "//metropolis/node",
         "//metropolis/proto/common",
         "//metropolis/test/launch",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
     ],
 )
 
diff --git a/metropolis/test/launch/cli/launch/BUILD.bazel b/metropolis/test/launch/cli/launch/BUILD.bazel
index 038373f..72825d9 100644
--- a/metropolis/test/launch/cli/launch/BUILD.bazel
+++ b/metropolis/test/launch/cli/launch/BUILD.bazel
@@ -1,4 +1,3 @@
-load("@bazel_skylib//rules:native_binary.bzl", "native_test")
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
 
 go_library(
diff --git a/metropolis/test/localregistry/BUILD.bazel b/metropolis/test/localregistry/BUILD.bazel
index 548960a..fa1f229 100644
--- a/metropolis/test/localregistry/BUILD.bazel
+++ b/metropolis/test/localregistry/BUILD.bazel
@@ -13,7 +13,7 @@
         "@com_github_docker_distribution//manifest/schema2",
         "@com_github_docker_distribution//reference",
         "@com_github_opencontainers_go_digest//:go-digest",
-        "@io_bazel_rules_go//go/runfiles:go_default_library",
+        "@io_bazel_rules_go//go/runfiles",
         "@org_golang_google_protobuf//encoding/prototext",
     ],
 )
diff --git a/metropolis/test/localregistry/def.bzl b/metropolis/test/localregistry/def.bzl
index c5fc560..289dc34 100644
--- a/metropolis/test/localregistry/def.bzl
+++ b/metropolis/test/localregistry/def.bzl
@@ -1,7 +1,7 @@
 #load("@io_bazel_rules_docker//container:providers.bzl", "ImageInfo")
 
 def _localregistry_manifest_impl(ctx):
-    manifest_out = ctx.actions.declare_file(ctx.label.name+".prototxt")
+    manifest_out = ctx.actions.declare_file(ctx.label.name + ".prototxt")
 
     images = []
     referenced = [manifest_out]
@@ -17,7 +17,6 @@
     ctx.actions.write(manifest_out, proto.encode_text(struct(images = images)))
     return [DefaultInfo(runfiles = ctx.runfiles(files = referenced), files = depset([manifest_out]))]
 
-
 localregistry_manifest = rule(
     implementation = _localregistry_manifest_impl,
     doc = """
@@ -29,7 +28,7 @@
             doc = """
                 List of images to be served from the local registry.
             """,
-           providers = [],
+            providers = [],
         ),
     },
 )
diff --git a/metropolis/test/localregistry/spec/BUILD.bazel b/metropolis/test/localregistry/spec/BUILD.bazel
index 71253d1..871fe35 100644
--- a/metropolis/test/localregistry/spec/BUILD.bazel
+++ b/metropolis/test/localregistry/spec/BUILD.bazel
@@ -1,6 +1,6 @@
-load("@rules_proto//proto:defs.bzl", "proto_library")
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
 
 proto_library(
     name = "spec_proto",