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/metropolis/node/build/mkcpio/BUILD.bazel b/metropolis/node/build/mkcpio/BUILD.bazel
index 5a93d3a..f0bb779 100644
--- a/metropolis/node/build/mkcpio/BUILD.bazel
+++ b/metropolis/node/build/mkcpio/BUILD.bazel
@@ -1,20 +1,20 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
- name = "go_default_library",
+ name = "mkcpio_lib",
srcs = ["main.go"],
importpath = "source.monogon.dev/metropolis/node/build/mkcpio",
visibility = ["//visibility:private"],
deps = [
- "//metropolis/node/build/fsspec:go_default_library",
- "@com_github_cavaliergopher_cpio//:go_default_library",
- "@com_github_pierrec_lz4_v4//:go_default_library",
- "@org_golang_x_sys//unix:go_default_library",
+ "//metropolis/node/build/fsspec",
+ "@com_github_cavaliergopher_cpio//:cpio",
+ "@com_github_pierrec_lz4_v4//:lz4",
+ "@org_golang_x_sys//unix",
],
)
go_binary(
name = "mkcpio",
- embed = [":go_default_library"],
+ embed = [":mkcpio_lib"],
visibility = ["//visibility:public"],
)
diff --git a/metropolis/node/build/mkcpio/main.go b/metropolis/node/build/mkcpio/main.go
index 10deb5a..bde7082 100644
--- a/metropolis/node/build/mkcpio/main.go
+++ b/metropolis/node/build/mkcpio/main.go
@@ -174,7 +174,7 @@
inF.Close()
case *fsspec.Directory:
if err := cpioWriter.WriteHeader(&cpio.Header{
- Mode: cpio.FileMode(i.Mode) | cpio.ModeDir,
+ Mode: cpio.FileMode(i.Mode) | cpio.TypeDir,
Name: strings.TrimPrefix(i.Path, "/"),
}); err != nil {
log.Fatalf("Failed to write cpio header for directory %q: %v", i.Path, err)
@@ -182,7 +182,7 @@
case *fsspec.SymbolicLink:
if err := cpioWriter.WriteHeader(&cpio.Header{
// Symlinks are 0777 by definition (from man 7 symlink on Linux)
- Mode: 0777 | cpio.ModeSymlink,
+ Mode: 0777 | cpio.TypeSymlink,
Name: strings.TrimPrefix(i.Path, "/"),
Linkname: i.TargetPath,
}); err != nil {
@@ -192,11 +192,11 @@
mode := cpio.FileMode(i.Mode)
switch i.Type {
case fsspec.SpecialFile_CHARACTER_DEV:
- mode |= cpio.ModeCharDevice
+ mode |= cpio.TypeChar
case fsspec.SpecialFile_BLOCK_DEV:
- mode |= cpio.ModeDevice
+ mode |= cpio.TypeBlock
case fsspec.SpecialFile_FIFO:
- mode |= cpio.ModeNamedPipe
+ mode |= cpio.TypeFifo
}
if err := cpioWriter.WriteHeader(&cpio.Header{