WORKSPACE: bump rules_go go 0.29 and Go to 1.17.1
The changes to nogo are from rules_go being able to use go_library
targets as part toolchain definitions. gVisor needed to be bumped
to be compatible with Go 1.17. It also needs a fix for us not having
the systemd cgroup controller.
Change-Id: I058b5c68d97809a286fbe36df00e49e55874dfd5
Reviewed-on: https://review.monogon.dev/c/monogon/+/438
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/third_party/go/patches/commentwrap-tool-library.patch b/third_party/go/patches/commentwrap-tool-library.patch
deleted file mode 100644
index a5bf2cb..0000000
--- a/third_party/go/patches/commentwrap-tool-library.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-Copyright 2021 The Monogon Project Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-This adds a go_tool_library target to github.com/corverroos/commentwrap. This can
-be removed when go_tool_library gets replaced with transitions:
-https://github.com/bazelbuild/rules_go/issues/2374
-
-diff -ur a/BUILD.bazel b/BUILD.bazel
---- a/BUILD.bazel 2021-05-20 13:21:49.582041541 +0200
-+++ b/BUILD.bazel 2021-05-21 14:25:51.550052340 +0200
-@@ -1,4 +1,15 @@
--load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
-+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "go_tool_library")
-+
-+go_tool_library(
-+ name = "go_tool_library",
-+ srcs = ["commentwrap.go"],
-+ importpath = "github.com/corverroos/commentwrap",
-+ visibility = ["//visibility:public"],
-+ deps = [
-+ "@com_github_muesli_reflow//:go_tool_library",
-+ "@org_golang_x_tools//go/analysis:go_tool_library",
-+ ],
-+)
-
- go_library(
- name = "go_default_library",
diff --git a/third_party/go/patches/gvisor-cgroup-fix.patch b/third_party/go/patches/gvisor-cgroup-fix.patch
new file mode 100644
index 0000000..aba0b4a
--- /dev/null
+++ b/third_party/go/patches/gvisor-cgroup-fix.patch
@@ -0,0 +1,27 @@
+From fcd48e672489f41c9977e092937ff806a7e772bd Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@monogon.tech>
+Date: Thu, 11 Nov 2021 13:58:50 +0100
+Subject: [PATCH] Make systemd cgroup optional
+
+This breaks gVisor on systems that use custom inits/cgroup setups which
+don't have this cgroup and don't need it.
+---
+ runsc/cgroup/cgroup.go | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go
+index 0eb5821a9..2116bddca 100644
+--- a/runsc/cgroup/cgroup.go
++++ b/runsc/cgroup/cgroup.go
+@@ -58,7 +58,7 @@ var controllers = map[string]controller{
+ "freezer": &noop{},
+ "perf_event": &noop{},
+ "rdma": &noop{isOptional: true},
+- "systemd": &noop{},
++ "systemd": &noop{isOptional: true},
+ }
+
+ // IsOnlyV2 checks whether cgroups V2 is enabled and V1 is not.
+--
+2.25.1
+
diff --git a/third_party/go/patches/k8s-infra-fix-go116.patch b/third_party/go/patches/k8s-infra-fix-go116.patch
new file mode 100644
index 0000000..bf35938
--- /dev/null
+++ b/third_party/go/patches/k8s-infra-fix-go116.patch
@@ -0,0 +1,23 @@
+From 5cf776eb8f872f78cf7325c39fbfe1777f702407 Mon Sep 17 00:00:00 2001
+From: Mike Danese <mikedanese@google.com>
+Date: Fri, 26 Feb 2021 13:39:16 -0800
+Subject: [PATCH] fix go_genrule for 1.16
+
+---
+ defs/go.bzl | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/defs/go.bzl b/defs/go.bzl
+index f4617e1..8873253 100644
+--- a/defs/go.bzl
++++ b/defs/go.bzl
+@@ -90,6 +90,9 @@ def _go_genrule_impl(ctx):
+ "PATH": ctx.configuration.host_path_separator.join(["/usr/local/bin", "/bin", "/usr/bin"]),
+ "GOPATH": paths.dirname(gopath_placeholder.path),
+ "GOROOT": paths.dirname(go.sdk.root_file.path),
++ # hack to tie us over until we fix this to use modules or stop using
++ # it.
++ "GO111MODULE": "off",
+ })
+
+ ctx.actions.run(
diff --git a/third_party/go/patches/reflow-tool-library.patch b/third_party/go/patches/reflow-tool-library.patch
deleted file mode 100644
index dcee286..0000000
--- a/third_party/go/patches/reflow-tool-library.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Copyright 2021 The Monogon Project Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-This adds a go_tool_library target to github.com/muesli/reflow. This can
-be removed when go_tool_library gets replaced with transition:
-https://github.com/bazelbuild/rules_go/issues/2374
-
-diff -ur a/BUILD.bazel b/BUILD.bazel
---- a/BUILD.bazel 2021-05-21 14:36:39.411306726 +0200
-+++ b/BUILD.bazel 2021-05-21 14:37:02.602460127 +0200
-@@ -1,4 +1,14 @@
--load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
-+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "go_tool_library")
-+
-+go_tool_library(
-+ name = "go_tool_library",
-+ srcs = [
-+ "ansibuffer.go",
-+ "reflow.go",
-+ ],
-+ importpath = "github.com/muesli/reflow",
-+ visibility = ["//visibility:public"],
-+)
-
- go_library(
- name = "go_default_library",