github.com/bazelbuild/bazel-gazelle@v0.36.1-0.20240520142334-61b277ba6fed/language/go/def.bzl (about) 1 load("@io_bazel_rules_go//go:def.bzl", "go_context") 2 3 def _std_package_list_impl(ctx): 4 go = go_context(ctx) 5 args = ctx.actions.args() 6 args.add_all([go.package_list, ctx.outputs.out]) 7 ctx.actions.run( 8 inputs = [go.package_list], 9 outputs = [ctx.outputs.out], 10 executable = ctx.executable._gen_std_package_list, 11 arguments = [args], 12 mnemonic = "GoStdPackageList", 13 ) 14 return [DefaultInfo(files = depset([ctx.outputs.out]))] 15 16 std_package_list = rule( 17 implementation = _std_package_list_impl, 18 attrs = { 19 "out": attr.output(mandatory = True), 20 "_gen_std_package_list": attr.label( 21 default = "//language/go/gen_std_package_list", 22 cfg = "exec", 23 executable = True, 24 ), 25 "_go_context_data": attr.label( 26 default = "@io_bazel_rules_go//:go_context_data", 27 ), 28 }, 29 toolchains = ["@io_bazel_rules_go//go:toolchain"], 30 )