From 49ad14b07f82cde899e2340bfa67f22fb2675ca9 Mon Sep 17 00:00:00 2001 From: Gorka Lerchundi Osa Date: Mon, 13 Aug 2018 08:48:22 +0200 Subject: [PATCH] config: disable plugin backend through 'noplugin' tag Debugging Hydra in Go 1.10 and 1.11 (confirmed by one of its members), is not possible due to [this unresolved bug](https://github.com/golang/go/issues/23733) which is related to the use of the plugin functionality. This change allows passing a build tag which will disable plugin implementation and therefore allow to debug in all the use-cases where plugin backend is not needed. Signed-off-by: Gorka Lerchundi Osa --- config/backend_plugin.go | 40 ++++++++++++++++--------------- config/backend_plugin_noplugin.go | 37 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 config/backend_plugin_noplugin.go diff --git a/config/backend_plugin.go b/config/backend_plugin.go index ee78fbb7a7a..bf0f3f0ee60 100644 --- a/config/backend_plugin.go +++ b/config/backend_plugin.go @@ -1,22 +1,24 @@ -/* - * Copyright © 2015-2018 Aeneas Rekkas - * - * 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. - * - * @author Aeneas Rekkas - * @copyright 2015-2018 Aeneas Rekkas - * @license Apache-2.0 - */ +// +// Copyright © 2015-2018 Aeneas Rekkas +// +// 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. +// +// @author Aeneas Rekkas +// @copyright 2015-2018 Aeneas Rekkas +// @license Apache-2.0 +// + +// +build !noplugin package config diff --git a/config/backend_plugin_noplugin.go b/config/backend_plugin_noplugin.go new file mode 100644 index 00000000000..bf9c404f351 --- /dev/null +++ b/config/backend_plugin_noplugin.go @@ -0,0 +1,37 @@ +// +// Copyright © 2015-2018 Gorka Lerchundi Osa +// +// 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. +// +// @author Gorka Lerchundi Osa +// @copyright 2015-2018 Gorka Lerchundi Osa +// @license Apache-2.0 +// + +// +build noplugin + +package config + +import ( + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +type PluginConnection struct { + Config *Config + Logger logrus.FieldLogger +} + +func (c *PluginConnection) Load() error { + return errors.New("config: unable to load plugin connection because 'noplugin' tag was declared") +}