From 353b2748cff064250663ee3cc6b1734335c0a536 Mon Sep 17 00:00:00 2001 From: Maximilian Eschenbacher Date: Sat, 28 Nov 2020 22:34:33 +0100 Subject: [PATCH] Overall += Add{OK,Warning,Critical,Unknown} The current Add() requires the user to manually access the defined constants for OK, Warning, Critical, and Unknown. The four new methods to not require the use to manually specify them. --- result/overall.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/result/overall.go b/result/overall.go index 369e973..254d6c1 100644 --- a/result/overall.go +++ b/result/overall.go @@ -16,6 +16,22 @@ type Overall struct { Outputs []string } +func (o *Overall) AddOK(output string) { + o.Add(check.OK, output) +} + +func (o *Overall) AddWarning(output string) { + o.Add(check.Warning, output) +} + +func (o *Overall) AddCritical(output string) { + o.Add(check.Critical, output) +} + +func (o *Overall) AddUnknown(output string) { + o.Add(check.Unknown, output) +} + func (o *Overall) Add(state int, output string) { switch state { case check.OK: