blob: 409695caf08c6213a0d12db898eb6da58e156212 [file] [log] [blame]
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_test")
load("@bazeldnf//:def.bzl", "bazeldnf")
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@rules_multirun//:defs.bzl", "command", "multirun")
exports_files([
"MODULE.bazel",
])
# gazelle:prefix source.monogon.dev
# gazelle:go_naming_convention import
# gazelle:exclude **/gomod-generated-placeholder.go
# gazelle:exclude .bazeldnf/**
gazelle(name = "gazelle")
gazelle_test(
name = "gazelle_test",
tags = ["no-remote"],
workspace = "//:MODULE.bazel",
)
BUILDIFIER_EXCLUDES = [
"./.git/*",
"./.ijwb/*",
]
# Buildifier formats all Starlark files.
buildifier(
name = "buildifier",
exclude_patterns = BUILDIFIER_EXCLUDES,
lint_mode = "fix",
mode = "fix",
)
buildifier_test(
name = "buildifier_test",
exclude_patterns = BUILDIFIER_EXCLUDES,
lint_mode = "warn",
lint_warnings = [
"-module-docstring",
"-function-docstring-args",
"-function-docstring",
"-function-docstring-header",
"-function-docstring-return",
],
no_sandbox = True,
tags = ["no-remote"],
workspace = "//:MODULE.bazel",
)
# Shortcut for the Go SDK
alias(
name = "go",
actual = "@io_bazel_rules_go//go",
visibility = ["//visibility:public"],
)
# bazeldnf binary
bazeldnf(name = "bazeldnf")
# Shortcuts for top-level binaries/tools
# Shortcut for kubectl when running through bazel run
# (don't depend on this, it might turn into an env-based PATH shortcut, use
# @io_k8s_kubernetes//cmd/kubectl instead)
alias(
name = "kubectl",
actual = "@io_k8s_kubernetes//cmd/kubectl:kubectl",
)
# Shortcut for the Delve debugger for interactive debugging
alias(
name = "dlv",
actual = "@com_github_go_delve_delve//cmd/dlv:dlv",
)
alias(
name = "goimports",
actual = "@org_golang_x_tools//cmd/goimports:goimports",
visibility = ["//visibility:public"],
)
command(
name = "go-mod-tidy",
arguments = [
"mod",
"tidy",
],
command = ":go",
)
# Shortcut to update go.mod, gazelle files and formatting.
multirun(
name = "tidy",
commands = [
":go-mod-tidy",
":gazelle",
":buildifier",
],
)