From 717169bb88910551dfe63cdca01c8335ff73193e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 23 Aug 2022 09:40:12 +0200 Subject: [PATCH] plugin: remove go < 1.8 stub, enable on windows and arm64 - we don't support go < 1.8. this restriction as added because plugin support requires go 1.8 or up, but with such old versions being EOL, this check was rather redundant - add back arm64 support; in 6bd0710831cb0796e903b7e9e41ca33214913620, non-amd64 was disabled, pending golang/go#17138, which was tracking arm64 support, and is now resolved. It's unclear if architectures other than amd64 and arm64 are supported, so keeping it restricted to amd64 and arm64. - enable plugin support on Windows; it was disabled in 0b44e24c073a3abb8953cd9e3fafcaa045d7e2f1 but the code looks to take windows into account. Signed-off-by: Sebastiaan van Stijn --- plugin/plugin.go | 6 +++++- plugin/{plugin_go18.go => plugin_supported.go} | 2 +- plugin/{plugin_other.go => plugin_unsupported.go} | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) rename plugin/{plugin_go18.go => plugin_supported.go} (95%) rename plugin/{plugin_other.go => plugin_unsupported.go} (65%) diff --git a/plugin/plugin.go b/plugin/plugin.go index d1b94ac44..45fc22c98 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -138,7 +138,11 @@ var register = struct { r []*Registration }{} -// Load loads all plugins at the provided path into containerd +// Load loads all plugins at the provided path into containerd. +// +// Load is currently only implemented on non-static, non-gccgo builds for amd64 +// and arm64, and plugins must be built with the exact same version of Go as +// containerd itself. func Load(path string) (err error) { defer func() { if v := recover(); v != nil { diff --git a/plugin/plugin_go18.go b/plugin/plugin_supported.go similarity index 95% rename from plugin/plugin_go18.go rename to plugin/plugin_supported.go index 0ee442d95..0eaf47064 100644 --- a/plugin/plugin_go18.go +++ b/plugin/plugin_supported.go @@ -1,4 +1,4 @@ -//go:build go1.8 && !windows && amd64 && !static_build && !gccgo +//go:build (amd64 || arm64) && !static_build && !gccgo /* Copyright The containerd Authors. diff --git a/plugin/plugin_other.go b/plugin/plugin_unsupported.go similarity index 65% rename from plugin/plugin_other.go rename to plugin/plugin_unsupported.go index c0b53a6b4..b250be357 100644 --- a/plugin/plugin_other.go +++ b/plugin/plugin_unsupported.go @@ -1,4 +1,4 @@ -//go:build !go1.8 || windows || !amd64 || static_build || gccgo +//go:build (!amd64 && !arm64) || static_build || gccgo /* Copyright The containerd Authors. @@ -18,7 +18,11 @@ package plugin +// loadPlugins is not supported; +// +// - with gccgo: gccgo has no plugin support golang/go#36403 +// - on static builds; https://github.com/containerd/containerd/commit/0d682e24a1ba8e93e5e54a73d64f7d256f87492f +// - on architectures other than amd64 and arm64 (other architectures need to be tested) func loadPlugins(path string) error { - // plugins not supported until 1.8 return nil }