From c30f5d47964b50a6db0875be7a05aafbb73e4d75 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Sat, 5 Oct 2024 02:15:28 +0000 Subject: [PATCH] Lint common/errors/feature_errors.go --- common/errors/feature_errors.go | 68 ++++++++++++++++----------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/common/errors/feature_errors.go b/common/errors/feature_errors.go index 3cacd2b9..40c0ee9b 100644 --- a/common/errors/feature_errors.go +++ b/common/errors/feature_errors.go @@ -1,34 +1,34 @@ -package errors - -import ( - "context" -) - -// PrintMigrateFeatureInfo prints a notice of the upcoming feature migration. -// Place it after the source feature related config file pharser code. -// Important note: Only use this when the target migrating feature is under construction. -// Important note: Even when the target migrating feature has finished its construction, this notice can still be used yet before announcing deprecation of the old feature. -// Do not remove this function even there is no reference to it. -func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) { - LogInfo(context.Background(), "The feature " + sourceFeature + " will be migrated to " + targetFeature + " in the future.") -} - -// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature. -// Do not remove this function even there is no reference to it. -func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) { - if len(migrateFeature) > 0 { - LogWarning(context.Background(), "This feature " + feature + " is deprecated and being migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation before removal.") - } else { - LogWarning(context.Background(), "This feature " + feature + " is deprecated. Please update your config(s) according to release note and documentation before removal.") - } -} - -// PrintRemovedFeatureError prints an error message for removed feature then return an error. And after long enough time the message can also be removed, uses as an indicator. -// Do not remove this function even there is no reference to it. -func PrintRemovedFeatureError(feature string, migrateFeature string) (error) { - if len(migrateFeature) > 0 { - return New("The feature " + feature + " has been removed and migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation.") - } else { - return New("The feature " + feature + " has been removed. Please update your config(s) according to release note and documentation.") - } -} +package errors + +import ( + "context" +) + +// PrintMigrateFeatureInfo prints a notice of the upcoming feature migration. +// Place it after the source feature related config file pharser code. +// Important note: Only use this when the target migrating feature is under construction. +// Important note: Even when the target migrating feature has finished its construction, this notice can still be used yet before announcing deprecation of the old feature. +// Do not remove this function even there is no reference to it. +func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) { + LogInfo(context.Background(), "The feature "+sourceFeature+" will be migrated to "+targetFeature+" in the future.") +} + +// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature. +// Do not remove this function even there is no reference to it. +func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) { + if len(migrateFeature) > 0 { + LogWarning(context.Background(), "This feature "+feature+" is deprecated and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.") + } else { + LogWarning(context.Background(), "This feature "+feature+" is deprecated. Please update your config(s) according to release note and documentation before removal.") + } +} + +// PrintRemovedFeatureError prints an error message for removed feature then return an error. And after long enough time the message can also be removed, uses as an indicator. +// Do not remove this function even there is no reference to it. +func PrintRemovedFeatureError(feature string, migrateFeature string) error { + if len(migrateFeature) > 0 { + return New("The feature " + feature + " has been removed and migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation.") + } else { + return New("The feature " + feature + " has been removed. Please update your config(s) according to release note and documentation.") + } +}