| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 1 | go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk") |
| Tim Windelschmidt | 677de97 | 2024-09-25 05:30:04 +0200 | [diff] [blame] | 2 | go_sdk.download(version = "1.23.1") |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 3 | go_sdk.nogo(nogo = "//build/analysis:nogo") |
| 4 | |
| 5 | go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") |
| 6 | go_deps.from_file(go_mod = "//:go.mod") |
| 7 | |
| 8 | # All *direct* Go dependencies of the module have to be listed explicitly. |
| 9 | # This list can be automatically updated by running "bazel mod tidy". |
| 10 | use_repo( |
| 11 | go_deps, |
| 12 | "co_honnef_go_tools", |
| 13 | "com_4d63_gocheckcompilerdirectives", |
| 14 | "com_github_adrg_xdg", |
| 15 | "com_github_cavaliergopher_cpio", |
| 16 | "com_github_cenkalti_backoff_v4", |
| 17 | "com_github_cockroachdb_cockroach_go_v2", |
| 18 | "com_github_container_storage_interface_spec", |
| Lorenz Brun | 0ec0c53 | 2024-08-29 12:39:47 +0000 | [diff] [blame] | 19 | "com_github_containerd_containerd_v2", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 20 | "com_github_containernetworking_plugins", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 21 | "com_github_coreos_go_semver", |
| 22 | "com_github_corverroos_commentwrap", |
| 23 | "com_github_diskfs_go_diskfs", |
| 24 | "com_github_docker_distribution", |
| Serge Bazanski | 0d9e125 | 2024-09-03 12:16:47 +0200 | [diff] [blame] | 25 | "com_github_gdamore_tcell_v2", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 26 | "com_github_go_delve_delve", |
| 27 | "com_github_golang_migrate_migrate_v4", |
| 28 | "com_github_google_cel_go", |
| 29 | "com_github_google_certificate_transparency_go", |
| 30 | "com_github_google_go_cmp", |
| 31 | "com_github_google_go_tpm", |
| 32 | "com_github_google_go_tpm_tools", |
| 33 | "com_github_google_gopacket", |
| 34 | "com_github_google_nftables", |
| 35 | "com_github_google_uuid", |
| 36 | "com_github_iancoleman_strcase", |
| 37 | "com_github_improbable_eng_grpc_web", |
| 38 | "com_github_insomniacslk_dhcp", |
| 39 | "com_github_joho_godotenv", |
| 40 | "com_github_kballard_go_shellquote", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 41 | "com_github_klauspost_compress", |
| 42 | "com_github_lib_pq", |
| 43 | "com_github_mattn_go_shellwords", |
| 44 | "com_github_mdlayher_arp", |
| 45 | "com_github_mdlayher_ethernet", |
| 46 | "com_github_mdlayher_ethtool", |
| 47 | "com_github_mdlayher_genetlink", |
| 48 | "com_github_mdlayher_kobject", |
| 49 | "com_github_mdlayher_netlink", |
| 50 | "com_github_mdlayher_packet", |
| Jan Schär | 4a18022 | 2024-07-29 16:32:54 +0200 | [diff] [blame] | 51 | "com_github_miekg_dns", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 52 | "com_github_mitchellh_go_wordwrap", |
| 53 | "com_github_opencontainers_go_digest", |
| 54 | "com_github_opencontainers_runc", |
| 55 | "com_github_packethost_packngo", |
| 56 | "com_github_pkg_errors", |
| 57 | "com_github_pkg_sftp", |
| 58 | "com_github_prometheus_client_golang", |
| 59 | "com_github_prometheus_node_exporter", |
| Serge Bazanski | 0d9e125 | 2024-09-03 12:16:47 +0200 | [diff] [blame] | 60 | "com_github_rivo_uniseg", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 61 | "com_github_rmohr_bazeldnf", |
| 62 | "com_github_sbezverk_nfproxy", |
| Tim Windelschmidt | 7a1b27d | 2024-02-22 23:54:58 +0100 | [diff] [blame] | 63 | "com_github_schollz_progressbar_v3", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 64 | "com_github_spf13_cobra", |
| 65 | "com_github_spf13_pflag", |
| 66 | "com_github_sqlc_dev_sqlc", |
| 67 | "com_github_stretchr_testify", |
| 68 | "com_github_vishvananda_netlink", |
| 69 | "com_github_yalue_native_endian", |
| 70 | "com_google_cloud_go_storage", |
| 71 | "com_zx2c4_golang_wireguard_wgctrl", |
| 72 | "dev_gvisor_gvisor", |
| 73 | "io_etcd_go_etcd_api_v3", |
| 74 | "io_etcd_go_etcd_client_pkg_v3", |
| 75 | "io_etcd_go_etcd_client_v3", |
| 76 | "io_etcd_go_etcd_server_v3", |
| 77 | "io_etcd_go_etcd_tests_v3", |
| 78 | "io_k8s_api", |
| 79 | "io_k8s_apimachinery", |
| 80 | "io_k8s_apiserver", |
| 81 | "io_k8s_cli_runtime", |
| 82 | "io_k8s_client_go", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 83 | "io_k8s_component_base", |
| 84 | "io_k8s_klog_v2", |
| 85 | "io_k8s_kubectl", |
| 86 | "io_k8s_kubelet", |
| 87 | "io_k8s_kubernetes", |
| 88 | "io_k8s_pod_security_admission", |
| Jan Schär | a48bd3c | 2024-07-29 17:22:18 +0200 | [diff] [blame] | 89 | "io_k8s_utils", |
| Lorenz Brun | 227c5cb | 2025-01-09 21:39:55 +0100 | [diff] [blame] | 90 | "org_go4_netipx", |
| Tim Windelschmidt | 5178dd7 | 2024-12-04 04:38:45 +0100 | [diff] [blame] | 91 | "org_golang_google_api", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 92 | "org_golang_google_genproto_googleapis_api", |
| 93 | "org_golang_google_grpc", |
| 94 | "org_golang_google_protobuf", |
| 95 | "org_golang_x_crypto", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 96 | "org_golang_x_net", |
| 97 | "org_golang_x_sync", |
| 98 | "org_golang_x_sys", |
| Tim Windelschmidt | 7a1b27d | 2024-02-22 23:54:58 +0100 | [diff] [blame] | 99 | "org_golang_x_term", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 100 | "org_golang_x_text", |
| 101 | "org_golang_x_time", |
| 102 | "org_golang_x_tools", |
| 103 | "org_uber_go_multierr", |
| 104 | "org_uber_go_zap", |
| 105 | ) |
| 106 | |
| 107 | # Instead of defining a gazelle/module override for every dependency, we have a |
| 108 | # big dict containing all of them. |
| 109 | OVERRIDES = { |
| Lorenz Brun | 0ec0c53 | 2024-08-29 12:39:47 +0000 | [diff] [blame] | 110 | "github.com/containerd/containerd/v2": { |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 111 | "directives": [ |
| 112 | "gazelle:proto disable", |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 113 | "gazelle:build_tags no_aufs,no_btrfs,no_devmapper,no_zfs", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 114 | ], |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 115 | }, |
| 116 | "github.com/containerd/cgroups/v3": { |
| 117 | "directives": [ |
| 118 | "gazelle:proto disable", |
| 119 | ], |
| 120 | }, |
| 121 | "github.com/containerd/nri": { |
| 122 | "directives": [ |
| 123 | "gazelle:proto disable", |
| 124 | ], |
| 125 | }, |
| 126 | "github.com/gogo/protobuf": { |
| 127 | "directives": [ |
| 128 | "gazelle:proto disable", |
| 129 | ], |
| 130 | }, |
| 131 | "github.com/google/cel-go": { |
| 132 | "build_file_generation": "on", |
| 133 | "directives": [ |
| 134 | "gazelle:go_naming_convention go_default_library", |
| 135 | ], |
| 136 | }, |
| 137 | "github.com/google/go-tpm-tools": { |
| 138 | "directives": [ |
| 139 | "gazelle:proto file", |
| 140 | ], |
| 141 | "pre_patches": [ |
| 142 | "//third_party/go/patches:go-tpm-tools-fix-proto-paths.patch", |
| 143 | ], |
| 144 | }, |
| 145 | "github.com/googleapis/gax-go/v2": { |
| 146 | "directives": [ |
| 147 | "gazelle:proto disable", |
| 148 | ], |
| 149 | }, |
| 150 | "github.com/Microsoft/hcsshim": { |
| 151 | "directives": [ |
| 152 | "gazelle:proto disable", |
| 153 | ], |
| 154 | }, |
| 155 | "github.com/opencontainers/runc": { |
| 156 | "directives": [ |
| 157 | "gazelle:build_tags seccomp", |
| 158 | ], |
| 159 | "patches": [ |
| 160 | "//third_party/go/patches:runc-add-cdeps.patch", |
| 161 | ], |
| 162 | }, |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 163 | "github.com/google/cadvisor": { |
| 164 | "directives": [ |
| 165 | "gazelle:proto disable_global", |
| 166 | ], |
| Lorenz Brun | 837cb8e | 2024-12-23 13:52:56 +0100 | [diff] [blame] | 167 | "pre_patches": [ |
| 168 | "//third_party/go/patches:cadvisor-errdefs1.patch", |
| 169 | ], |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 170 | }, |
| 171 | "github.com/sqlc-dev/sqlc": { |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 172 | "directives": [ |
| 173 | "gazelle:proto disable", |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 174 | "gazelle:build_tags nowasm", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 175 | ], |
| 176 | }, |
| 177 | "github.com/containerd/ttrpc": { |
| 178 | "directives": [ |
| 179 | "gazelle:proto disable", |
| 180 | ], |
| 181 | }, |
| 182 | "go.etcd.io/etcd/api/v3": { |
| 183 | "directives": [ |
| 184 | "gazelle:proto disable", |
| 185 | ], |
| 186 | }, |
| 187 | "go.etcd.io/etcd/raft/v3": { |
| 188 | "directives": [ |
| 189 | "gazelle:proto disable", |
| 190 | ], |
| 191 | }, |
| 192 | "go.etcd.io/etcd/server/v3": { |
| 193 | "directives": [ |
| 194 | "gazelle:proto disable", |
| 195 | ], |
| 196 | "patches": [ |
| 197 | "//third_party/go/patches:etcd-fix-embed-close.patch", |
| Jan Schär | e551d31 | 2024-09-17 12:38:54 +0200 | [diff] [blame] | 198 | "//third_party/go/patches:etcd-fix-islearner-panic.patch", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 199 | ], |
| 200 | }, |
| 201 | "github.com/grpc-ecosystem/grpc-gateway": { |
| 202 | # Force generation of new build files for this package, required due to changes in how gazelle handles @go_googleapis. |
| 203 | "build_file_generation": "on", |
| 204 | "directives": [ |
| 205 | "gazelle:exclude **/**_test.go", |
| 206 | "gazelle:exclude examples", |
| 207 | "gazelle:resolve go github.com/grpc-ecosystem/grpc-gateway/internal //internal", |
| 208 | "gazelle:resolve go github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options //protoc-gen-swagger/options", |
| 209 | "gazelle:proto disable_global", |
| 210 | ], |
| 211 | }, |
| 212 | "k8s.io/api": { |
| 213 | "directives": [ |
| 214 | "gazelle:proto disable", |
| 215 | ], |
| 216 | }, |
| 217 | "k8s.io/apiextensions-apiserver": { |
| 218 | "directives": [ |
| 219 | "gazelle:proto disable", |
| 220 | ], |
| 221 | }, |
| 222 | "k8s.io/apiserver": { |
| 223 | "directives": [ |
| 224 | "gazelle:proto disable", |
| 225 | ], |
| 226 | }, |
| 227 | "k8s.io/cri-api": { |
| 228 | "directives": [ |
| 229 | "gazelle:proto disable", |
| 230 | ], |
| 231 | }, |
| 232 | "k8s.io/kube-aggregator": { |
| 233 | "directives": [ |
| 234 | "gazelle:proto disable", |
| 235 | ], |
| 236 | }, |
| 237 | "k8s.io/kubelet": { |
| 238 | "directives": [ |
| 239 | "gazelle:proto disable", |
| 240 | ], |
| 241 | "patches": [ |
| 242 | "//third_party/go/patches:kubelet-fix-path.patch", |
| 243 | ], |
| 244 | }, |
| 245 | "k8s.io/kubernetes": { |
| 246 | "directives": [ |
| 247 | "gazelle:proto disable", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 248 | ], |
| 249 | "patches": [ |
| 250 | "//third_party/go/patches:k8s-native-metrics.patch", |
| 251 | "//third_party/go/patches:k8s-removed-block-device-pseudo-locks.patch", |
| 252 | "//third_party/go/patches:k8s-add-pause-build-file.patch", |
| 253 | "//third_party/go/patches:k8s-reserve-metropolis-ports-import.patch", |
| 254 | ], |
| 255 | "pre_patches": [ |
| 256 | "//third_party/go/patches:k8s-drop-legacy-log-path.patch", |
| 257 | "//third_party/go/patches:k8s-reserve-metropolis-ports.patch", |
| 258 | ], |
| 259 | }, |
| 260 | "k8s.io/metrics": { |
| 261 | "directives": [ |
| 262 | "gazelle:proto disable", |
| 263 | ], |
| 264 | }, |
| 265 | "google.golang.org/genproto/googleapis/api": { |
| 266 | "directives": [ |
| 267 | "gazelle:proto disable_global", |
| 268 | ], |
| 269 | }, |
| 270 | "google.golang.org/genproto/googleapis/rpc": { |
| 271 | "directives": [ |
| 272 | "gazelle:proto disable_global", |
| 273 | ], |
| 274 | }, |
| 275 | "google.golang.org/grpc": { |
| 276 | "directives": [ |
| 277 | "gazelle:proto disable", |
| 278 | ], |
| 279 | }, |
| 280 | "github.com/pingcap/tidb/parser": { |
| 281 | "build_file_generation": "on", |
| 282 | }, |
| 283 | "golang.org/x/mod": { |
| 284 | "build_extra_args": [ |
| 285 | "-go_naming_convention=import_alias", |
| 286 | "-go_naming_convention_external=import_alias", |
| 287 | ], |
| 288 | }, |
| 289 | "golang.org/x/sync": { |
| 290 | "build_extra_args": [ |
| 291 | "-go_naming_convention=import_alias", |
| 292 | "-go_naming_convention_external=import_alias", |
| 293 | ], |
| 294 | }, |
| 295 | "github.com/containernetworking/cni": { |
| 296 | "patches": [ |
| 297 | "//third_party/go/patches:cni-fix-cachepath.patch", |
| 298 | ], |
| 299 | }, |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 300 | "github.com/corverroos/commentwrap": { |
| 301 | "patches": [ |
| 302 | "//third_party/go/patches:commentwrap-uri.patch", |
| 303 | ], |
| 304 | }, |
| 305 | "github.com/go-delve/delve": { |
| 306 | "patches": [ |
| 307 | "//third_party/go/patches:delve-fix-cgo.patch", |
| 308 | ], |
| 309 | }, |
| 310 | "github.com/pganalyze/pg_query_go/v4": { |
| 311 | "patches": [ |
| 312 | "//third_party/go/patches:pganalyze-add-cdeps.patch", |
| 313 | ], |
| 314 | }, |
| 315 | "github.com/sbezverk/nfproxy": { |
| 316 | "pre_patches": [ |
| 317 | "//third_party/go/patches:nfproxy-adapt-to-k8s-1.28.patch", |
| Lorenz Brun | 11bf3d3 | 2025-01-07 17:49:27 +0100 | [diff] [blame] | 318 | "//third_party/go/patches:nfproxy-adapt-to-nftables-0.2.patch", |
| 319 | ], |
| 320 | }, |
| 321 | "github.com/google/nftables": { |
| 322 | "pre_patches": [ |
| 323 | "//third_party/go/patches:nftables-bigger-buffers.patch", |
| 324 | "//third_party/go/patches:nftables-dynamic-exprs.patch", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 325 | ], |
| 326 | }, |
| 327 | "k8s.io/kubectl": { |
| 328 | "patches": [ |
| 329 | "//third_party/go/patches:kubectl-fix-embed.patch", |
| 330 | ], |
| 331 | }, |
| 332 | "github.com/seccomp/libseccomp-golang": { |
| 333 | "patches": [ |
| 334 | "//third_party/go/patches:libseccomp.patch", |
| 335 | ], |
| 336 | }, |
| 337 | "github.com/vishvananda/netlink": { |
| 338 | "patches": [ |
| Lorenz Brun | 153c9c1 | 2025-01-07 17:44:45 +0100 | [diff] [blame] | 339 | "//third_party/go/patches:netlink-psample.patch", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 340 | ], |
| 341 | }, |
| 342 | "gvisor.dev/gvisor": { |
| 343 | "patches": [ |
| 344 | "//third_party/go/patches:gvisor-fix-syslog.patch", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 345 | ], |
| 346 | "pre_patches": [ |
| 347 | "//third_party/go/patches:gvisor-containerd-compat.patch", |
| Tim Windelschmidt | e5e90a8 | 2024-07-17 23:46:22 +0200 | [diff] [blame] | 348 | ], |
| 349 | }, |
| 350 | "go.etcd.io/etcd/tests/v3": { |
| 351 | "patches": [ |
| 352 | "//third_party/go/patches:etcd-integration-logging.patch", |
| 353 | ], |
| 354 | }, |
| 355 | "k8s.io/mount-utils": { |
| 356 | "pre_patches": [ |
| 357 | "//third_party/go/patches:k8s-native-mounter.patch", |
| 358 | ], |
| 359 | }, |
| 360 | "golang.org/x/tools": { |
| 361 | "patches": [ |
| 362 | "//third_party/go/patches:goimports-group-merging.patch", |
| 363 | ], |
| 364 | }, |
| 365 | } |
| 366 | |
| 367 | # MODULE.bazel doesn't support loops, but since we have lots of overrides, |
| 368 | # this is the more readable approach. |
| 369 | [ |
| 370 | [ |
| 371 | go_deps.gazelle_override( |
| 372 | build_extra_args = overrides.get("build_extra_args") or [], |
| 373 | build_file_generation = overrides.get("build_file_generation") or "auto", |
| 374 | directives = overrides.get("directives") or [], |
| 375 | path = path, |
| 376 | ), |
| 377 | go_deps.module_override( |
| 378 | patch_strip = 1, |
| 379 | patches = overrides.get("patches") or [], |
| 380 | path = path, |
| 381 | pre_patches = overrides.get("pre_patches") or [], |
| 382 | ), |
| 383 | ] |
| 384 | for path, overrides in OVERRIDES.items() |
| 385 | ] |