NETWAYS / go-check

A Golang library to create monitoring plugins for Icinga
https://pkg.go.dev/github.com/NETWAYS/go-check
GNU General Public License v2.0
13 stars 4 forks source link

Add initializer for PartialResult #110

Closed RincewindsHat closed 9 months ago

RincewindsHat commented 9 months ago

This commit adds a NewPartialResult function which returns a PartialResult struct with "sane" default, mainly setting the defaultState to "Unknown".

This should help developers implementing this library, since it avoids the following pattern:

sc := result.PartialResult{} sc.setDefaultState(check.Unknown)

This pattern is quite common, but in a sense useless.