treewide: switch to gomod and bump everything
This switches version resolution from fietsje to gomod and updates
all Go dependencies. It also bumps rules_go (required by gVisor) and
switches the Gazelle naming convention from go_default_xxx to the
standard Bazel convention of the default target having the package
name.
Since Kubernetes dropped upstream Bazel support and doesn't check in
all generated files I manually pregenerated the OpenAPI spec. This
should be fixed, but because of the already-huge scope of this CL
and the rebase complexity this is not in here.
Change-Id: Iec8ea613d06946882426c2f9fad5bda7e8aaf833
Reviewed-on: https://review.monogon.dev/c/monogon/+/639
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
Reviewed-by: Leopold Schabel <leo@nexantic.com>
diff --git a/build/analysis/BUILD.bazel b/build/analysis/BUILD.bazel
index 0cbb906..7f8cf1d 100644
--- a/build/analysis/BUILD.bazel
+++ b/build/analysis/BUILD.bazel
@@ -41,7 +41,7 @@
# 'standard' 80 characters long, as prose within comment blocks does not
# soft-reflow well.
"@com_github_corverroos_commentwrap//:go_default_library",
- "//build/analysis/noioutil:go_default_library",
- "//build/analysis/importsort:go_default_library",
+ "//build/analysis/noioutil",
+ "//build/analysis/importsort",
],
)
diff --git a/build/analysis/importsort/BUILD.bazel b/build/analysis/importsort/BUILD.bazel
index 309edfb..06f0030 100644
--- a/build/analysis/importsort/BUILD.bazel
+++ b/build/analysis/importsort/BUILD.bazel
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
- name = "go_default_library",
+ name = "importsort",
srcs = [
"classify.go",
"importsort.go",
@@ -9,16 +9,16 @@
importpath = "source.monogon.dev/build/analysis/importsort",
visibility = ["//visibility:public"],
deps = [
- "//build/analysis/lib:go_default_library",
- "@org_golang_x_tools//go/analysis:go_default_library",
+ "//build/analysis/lib",
+ "@org_golang_x_tools//go/analysis",
],
)
go_test(
- name = "go_default_test",
+ name = "importsort_test",
srcs = ["importsort_test.go"],
data = glob(["testdata/**"]),
- embed = [":go_default_library"],
+ embed = [":importsort"],
embedsrcs = [
"testdata/README.md",
"testdata/example.com/extlib/extlib.notgo",
@@ -32,7 +32,7 @@
"testdata/source.monogon.dev/project/b/b.notgo",
],
deps = [
- "//build/toolbase/gotoolchain:go_default_library",
- "@org_golang_x_tools//go/analysis/analysistest:go_default_library",
+ "//build/toolbase/gotoolchain",
+ "@org_golang_x_tools//go/analysis/analysistest",
],
)
diff --git a/build/analysis/lib/BUILD.bazel b/build/analysis/lib/BUILD.bazel
index 42666bf..f98d8f2 100644
--- a/build/analysis/lib/BUILD.bazel
+++ b/build/analysis/lib/BUILD.bazel
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
- name = "go_default_library",
+ name = "lib",
srcs = [
"generated.go",
"stdlib_packages.go",
diff --git a/build/analysis/lib/genstd/BUILD.bazel b/build/analysis/lib/genstd/BUILD.bazel
index 044eb95..6e779a3 100644
--- a/build/analysis/lib/genstd/BUILD.bazel
+++ b/build/analysis/lib/genstd/BUILD.bazel
@@ -1,18 +1,18 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
- name = "go_default_library",
+ name = "genstd_lib",
srcs = ["main.go"],
importpath = "source.monogon.dev/build/analysis/lib/genstd",
visibility = ["//visibility:private"],
deps = [
- "//build/toolbase/gotoolchain:go_default_library",
- "@org_golang_x_tools//go/packages:go_default_library",
+ "//build/toolbase/gotoolchain",
+ "@org_golang_x_tools//go/packages",
],
)
go_binary(
name = "genstd",
- embed = [":go_default_library"],
+ embed = [":genstd_lib"],
visibility = ["//visibility:public"],
)
diff --git a/build/analysis/nogo_config.json b/build/analysis/nogo_config.json
index 6da3a03..739d86e 100644
--- a/build/analysis/nogo_config.json
+++ b/build/analysis/nogo_config.json
@@ -6,39 +6,17 @@
},
"copylocks": {
"exclude_files": {
- "external/io_k8s_kubernetes/": "third_party",
- "external/com_github_google_gvisor/": "third_party",
- "external/io_k8s_sigs_structured_merge_diff/": "third_party",
- "external/io_k8s_component_base/": "third_party",
- "external/io_k8s_apiserver/": "third_party",
- "external/org_golang_google_protobuf/": "third_party",
- "external/com_github_armon_go_metrics/": "third_party",
- "external/com_github_elazarl_goproxy/": "third_party",
- "external/com_github_googleapis_gnostic/": "third_party",
- "external/com_github_pseudomuto_protoc_gen_doc": "third_party"
+ "external/": "third_party"
}
},
"lostcancel": {
"exclude_files": {
- "external/com_github_golang_protobuf/": "third_party",
- "external/com_github_grpc_ecosystem_grpc_gateway/runtime/": "third_party",
- "external/io_k8s_kubernetes/": "third_party",
- "external/com_github_denisenkom_go_mssqldb/": "third_party"
+ "external/": "third_party"
}
},
"unreachable": {
"exclude_files": {
- "external/io_k8s_kubernetes/": "third_party",
- "external/bazel_gazelle/pathtools": "third_party",
- "external/com_github_magiconair_properties": "third_party",
- "external/com_github_ghodss_yaml": "third_party",
- "external/io_k8s_kubectl": "third_party",
- "external/org_golang_google_protobuf/": "third_party",
- "external/com_github_shirou_gopsutil/": "unreachable",
- "external/io_k8s_apimachinery/": "third_party",
- "external/com_github_hpcloud_tail": "third_party",
- "external/com_github_flynn_go_shlex": "third_party",
- "external/com_github_masterminds_sprig": "third_party"
+ "external/": "third_party"
}
},
"assign": {
@@ -50,12 +28,13 @@
"exclude_files": {
"external/com_github_modern_go_reflect2/": "third_party",
"sqlite3.*go": "third_party",
- "external/com_github_google_gvisor/": "third_party",
+ "external/dev_gvisor_gvisor/": "third_party",
"external/io_k8s_sigs_structured_merge_diff/": "third_party",
"external/com_github_go_delve_delve/": "third_party",
"external/com_github_mailru_easyjson/jlexer/": "third_party",
"external/com_github_cilium_ebpf/": "third_party",
- "external/org_golang_x_sys": "third_party"
+ "external/org_golang_x_sys": "third_party",
+ "external/net_starlark_go": "third_party"
}
},
"unusedresult": {
@@ -73,10 +52,7 @@
},
"printf": {
"exclude_files": {
- "external/io_k8s_kubernetes/": "third_party",
- "external/runc/vendor/github.com/vishvananda/netlink": "third_party",
- "external/com_github_google_gvisor/": "third_party",
- "external/com_github_sbezverk_nfproxy/": "third_party"
+ "external/": "third_party"
}
},
"commentwrap": {
diff --git a/build/analysis/noioutil/BUILD.bazel b/build/analysis/noioutil/BUILD.bazel
index e627a0c..496820a 100644
--- a/build/analysis/noioutil/BUILD.bazel
+++ b/build/analysis/noioutil/BUILD.bazel
@@ -1,12 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
- name = "go_default_library",
+ name = "noioutil",
srcs = ["noioutil.go"],
importpath = "source.monogon.dev/build/analysis/noioutil",
visibility = ["//visibility:public"],
deps = [
- "//build/analysis/lib:go_default_library",
- "@org_golang_x_tools//go/analysis:go_default_library",
+ "//build/analysis/lib",
+ "@org_golang_x_tools//go/analysis",
],
)
diff --git a/build/analysis/tools.go b/build/analysis/tools.go
new file mode 100644
index 0000000..e6403d4
--- /dev/null
+++ b/build/analysis/tools.go
@@ -0,0 +1,8 @@
+//go:build tools
+// +build tools
+
+package analysis
+
+import (
+ _ "github.com/corverroos/commentwrap/cmd/commentwrap"
+)