blob: f1e10f50f0ef934d78a3138aa57b37aba37f4080 [file] [log] [blame]
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.from_file(go_mod = "//:go.mod")
go_sdk.nogo(
includes = ["all"],
nogo = "//build/analysis:nogo",
)
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
inject_repo(
go_deps,
"libpg_query",
"seccomp",
)
# All *direct* Go dependencies of the module have to be listed explicitly.
# This list can be automatically updated by running "bazel mod tidy".
use_repo(
go_deps,
"co_honnef_go_tools",
"com_4d63_gocheckcompilerdirectives",
"com_github_adrg_xdg",
"com_github_cavaliergopher_cpio",
"com_github_cenkalti_backoff_v4",
"com_github_container_storage_interface_spec",
"com_github_containerd_containerd_v2",
"com_github_containernetworking_plugins",
"com_github_coreos_go_semver",
"com_github_corverroos_commentwrap",
"com_github_diskfs_go_diskfs",
"com_github_gdamore_tcell_v2",
"com_github_go_delve_delve",
"com_github_golangci_gofmt",
"com_github_google_cel_go",
"com_github_google_certificate_transparency_go",
"com_github_google_go_cmp",
"com_github_google_go_tpm",
"com_github_google_go_tpm_tools",
"com_github_google_gopacket",
"com_github_google_nftables",
"com_github_google_uuid",
"com_github_insomniacslk_dhcp",
"com_github_joho_godotenv",
"com_github_kballard_go_shellquote",
"com_github_klauspost_compress",
"com_github_mattfenwick_cyclonus",
"com_github_mattn_go_shellwords",
"com_github_mdlayher_arp",
"com_github_mdlayher_ethernet",
"com_github_mdlayher_ethtool",
"com_github_mdlayher_genetlink",
"com_github_mdlayher_kobject",
"com_github_mdlayher_lldp",
"com_github_mdlayher_netlink",
"com_github_mdlayher_packet",
"com_github_miekg_dns",
"com_github_mitchellh_go_wordwrap",
"com_github_opencontainers_go_digest",
"com_github_opencontainers_image_spec",
"com_github_opencontainers_runc",
"com_github_pkg_errors",
"com_github_pkg_sftp",
"com_github_prometheus_client_golang",
"com_github_prometheus_node_exporter",
"com_github_rivo_uniseg",
"com_github_sbezverk_nfproxy",
"com_github_schollz_progressbar_v3",
"com_github_spf13_cobra",
"com_github_spf13_pflag",
"com_github_sqlc_dev_sqlc",
"com_github_stretchr_testify",
"com_github_vishvananda_netlink",
"com_github_yalue_native_endian",
"com_google_cloud_go_storage",
"com_zx2c4_golang_wireguard_wgctrl",
"dev_gvisor_gvisor",
"io_etcd_go_etcd_api_v3",
"io_etcd_go_etcd_client_pkg_v3",
"io_etcd_go_etcd_client_v3",
"io_etcd_go_etcd_server_v3",
"io_etcd_go_etcd_tests_v3",
"io_k8s_api",
"io_k8s_apimachinery",
"io_k8s_apiserver",
"io_k8s_cli_runtime",
"io_k8s_client_go",
"io_k8s_component_base",
"io_k8s_kubectl",
"io_k8s_kubelet",
"io_k8s_kubernetes",
"io_k8s_pod_security_admission",
"io_k8s_utils",
"org_dolansoft_git_dolansoft_k8s_nft_npc",
"org_go4_netipx",
"org_golang_google_api",
"org_golang_google_genproto_googleapis_api",
"org_golang_google_grpc",
"org_golang_google_protobuf",
"org_golang_x_crypto",
"org_golang_x_net",
"org_golang_x_sync",
"org_golang_x_sys",
"org_golang_x_term",
"org_golang_x_text",
"org_golang_x_time",
"org_golang_x_tools",
"org_uber_go_multierr",
"org_uber_go_zap",
)
# Instead of defining a gazelle/module override for every dependency, we have a
# big dict containing all of them.
OVERRIDES = {
"github.com/containerd/containerd/v2": {
"directives": [
"gazelle:proto disable",
"gazelle:build_tags no_aufs,no_btrfs,no_devmapper,no_zfs",
],
},
"github.com/containerd/cgroups/v3": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/containerd/nri": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/gogo/protobuf": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/google/cel-go": {
"build_file_generation": "on",
"directives": [
"gazelle:go_naming_convention go_default_library",
],
},
"github.com/google/go-tpm-tools": {
"directives": [
"gazelle:proto file",
],
"pre_patches": [
"//third_party/com_github_google_go_tpm_tools:go-tpm-tools-fix-proto-paths.patch",
],
},
"github.com/googleapis/gax-go/v2": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/Microsoft/hcsshim": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/opencontainers/runc": {
"directives": [
"gazelle:build_tags seccomp",
# Make @com_github_opencontainers_runc//:runc_lib visible
"gazelle:go_visibility //visibility:public",
],
"patches": [
"//third_party/com_github_opencontainers_runc:runc-add-cdeps.patch",
],
},
"github.com/google/cadvisor": {
"directives": [
"gazelle:proto disable_global",
],
"pre_patches": [
"//third_party/com_github_google_cadvisor:cadvisor-errdefs1.patch",
],
},
"github.com/sqlc-dev/sqlc": {
"directives": [
"gazelle:proto disable",
"gazelle:build_tags nowasm",
# Make @com_github_sqlc_dev_sqlc//cmd/sqlc:sqlc_lib visible
"gazelle:go_visibility //visibility:public",
],
},
"github.com/bytecodealliance/wasmtime-go/v14": {
"directives": [
"gazelle:go_naming_convention go_default_library",
],
},
"github.com/containerd/ttrpc": {
"directives": [
"gazelle:proto disable",
],
},
"go.etcd.io/etcd/api/v3": {
"directives": [
"gazelle:proto disable",
],
},
"go.etcd.io/raft/v3": {
"directives": [
"gazelle:proto disable",
],
},
"go.etcd.io/etcd/server/v3": {
"directives": [
"gazelle:proto disable",
],
"patches": [
"//third_party/com_go_etcd_io_etcd_server_v3:etcd-fix-embed-close.patch",
"//third_party/com_go_etcd_io_etcd_server_v3:fix-def-warn-threshold.patch",
"//third_party/com_go_etcd_io_etcd_server_v3:etcd-fix-islearner-panic.patch",
"//third_party/com_go_etcd_io_etcd_server_v3:shutdown-safety.patch",
],
},
"github.com/grpc-ecosystem/grpc-gateway/v2": {
# Force generation of new build files for this package, required due to changes in how gazelle handles @go_googleapis.
"build_file_generation": "on",
"directives": [
"gazelle:exclude **/**_test.go",
"gazelle:exclude examples",
"gazelle:resolve go github.com/grpc-ecosystem/grpc-gateway/internal //internal",
"gazelle:resolve go github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options //protoc-gen-swagger/options",
"gazelle:proto disable_global",
],
},
"k8s.io/api": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/kms": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/externaljwt": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/apiextensions-apiserver": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/apiserver": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/client-go": {
"patches": [
"//third_party/com_k8s_io_client_go:version-stamp.patch",
],
"pre_patches": [
"//third_party/com_k8s_io_client_go:k8s-fix-websocket-custom-dialer.patch",
],
},
"k8s.io/cri-api": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/kube-aggregator": {
"directives": [
"gazelle:proto disable",
],
},
"k8s.io/kubelet": {
"directives": [
"gazelle:proto disable",
],
"patches": [
"//third_party/com_k8s_io_kubelet:kubelet-fix-path.patch",
],
},
"k8s.io/kubernetes": {
"directives": [
"gazelle:proto disable",
],
"patches": [
"//third_party/com_k8s_io_kubernetes:k8s-native-metrics.patch",
"//third_party/com_k8s_io_kubernetes:k8s-removed-block-device-pseudo-locks.patch",
"//third_party/com_k8s_io_kubernetes:k8s-add-pause-build-file.patch",
"//third_party/com_k8s_io_kubernetes:k8s-reserve-metropolis-ports-import.patch",
],
"pre_patches": [
"//third_party/com_k8s_io_kubernetes:k8s-drop-legacy-log-path.patch",
"//third_party/com_k8s_io_kubernetes:k8s-reserve-metropolis-ports.patch",
],
},
"k8s.io/metrics": {
"directives": [
"gazelle:proto disable",
],
},
"google.golang.org/genproto/googleapis/api": {
"directives": [
"gazelle:proto disable_global",
],
},
"google.golang.org/genproto/googleapis/rpc": {
"directives": [
"gazelle:proto disable_global",
],
},
"google.golang.org/grpc": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/containers/ocicrypt": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/pingcap/tidb/parser": {
"build_file_generation": "on",
},
"golang.org/x/mod": {
"build_extra_args": [
"-go_naming_convention=import_alias",
"-go_naming_convention_external=import_alias",
],
},
"golang.org/x/sync": {
"build_extra_args": [
"-go_naming_convention=import_alias",
"-go_naming_convention_external=import_alias",
],
},
"github.com/containernetworking/cni": {
"patches": [
"//third_party/com_github_containernetworking_cni:cni-fix-cachepath.patch",
],
},
"github.com/containernetworking/plugins": {
"patches": [
"//third_party/com_github_containernetworking_plugins:cniplugins-add-linkgroup.patch",
],
},
"github.com/corverroos/commentwrap": {
"patches": [
"//third_party/com_github_corverroos_commentwrap:commentwrap-uri.patch",
],
},
"github.com/pganalyze/pg_query_go/v4": {
"patches": [
"//third_party/com_github_pganalyze_pg_query_go_v4:pganalyze-add-cdeps.patch",
],
},
"github.com/sbezverk/nfproxy": {
"pre_patches": [
"//third_party/com_github_sbezverk_nfproxy:nfproxy-adapt-to-k8s-1.28.patch",
"//third_party/com_github_sbezverk_nfproxy:nfproxy-adapt-to-nftables-0.2.patch",
],
},
"github.com/google/nftables": {
"pre_patches": [
"//third_party/com_github_google_nftables:nftables-dynamic-exprs.patch",
],
},
"k8s.io/kubectl": {
"patches": [
"//third_party/com_k8s_io_kubectl:kubectl-fix-embed.patch",
],
},
"sigs.k8s.io/apiserver-network-proxy/konnectivity-client": {
"directives": [
"gazelle:proto disable",
],
},
"github.com/seccomp/libseccomp-golang": {
"patches": [
"//third_party/com_github_seccomp_libseccomp_golang:libseccomp.patch",
],
},
"github.com/vishvananda/netlink": {
"patches": [
"//third_party/com_github_vishvananda_netlink:netlink-psample.patch",
],
},
"gvisor.dev/gvisor": {
"patches": [
"//third_party/com_gvisor_dev_gvisor:gvisor-fix-syslog.patch",
],
"pre_patches": [
"//third_party/com_gvisor_dev_gvisor:gvisor-containerd-compat.patch",
],
},
"go.etcd.io/etcd/tests/v3": {
"patches": [
"//third_party/com_go_etcd_io_etcd_tests_v3:etcd-integration-logging.patch",
],
},
"k8s.io/component-base": {
"patches": [
"//third_party/com_k8s_io_component_base:k8s-fix-metrics-data-race.patch",
"//third_party/com_k8s_io_component_base:version-stamp.patch",
],
},
"k8s.io/mount-utils": {
"pre_patches": [
"//third_party/com_k8s_io_mount_utils:k8s-native-mounter.patch",
],
},
"golang.org/x/tools": {
"patches": [
"//third_party/com_golang_org_x_tools:goimports-group-merging.patch",
],
},
}
# MODULE.bazel doesn't support loops, but since we have lots of overrides,
# this is the more readable approach.
[
[
go_deps.gazelle_override(
build_extra_args = overrides.get("build_extra_args") or [],
build_file_generation = overrides.get("build_file_generation") or "auto",
directives = overrides.get("directives") or [],
path = path,
),
go_deps.module_override(
patch_strip = 1,
patches = overrides.get("patches") or [],
path = path,
pre_patches = overrides.get("pre_patches") or [],
),
]
for path, overrides in OVERRIDES.items()
]