What's Changed
We have a lot of breaking changes. However, with the 1.0.0 we're going to avoid these in the future.
- Refactor result package by @RincewindsHat in #152
- Make Overall concurrency-safe by @martialblog in #158
- Merge worse.go into status.go by @martialblog in #155
- Fix perfdata example in README by @RincewindsHat in #154
- Provide commonly used symbols as public constants by @martialblog in #160
- Replace vertical bars in Exit and Overall output by @martialblog in #161
- Enable -race in unittests by @martialblog in #157
- Handle nil value in ExitError() by @christoph2497 in #164
- Add package level godoc and merge perfdata.go files by @martialblog in #156
- Fix worst state example by @RincewindsHat in #145
- Remove various old nolint statements by @martialblog in #149
- Update example in README by @martialblog in #140
- Extend convert and result test cases by @martialblog in #142
- Apply go fix by @RincewindsHat in #138
- Bump golangci-lint version by @martialblog in #139
Breaking changes
Refactored status to be a type. The Status type now implements the Stringer interface
Exit codes are now represented by a Status type instead of an integer. The previous constants have been replaced by this type. A constructor from an integer and string was added.
NewStatus(status int) (Status, error)
NewStatusFromString(status string) (Status, error)
The StatusText function was replaced by implementing the Stringer interface in the Status type
Removed ExitRaw, replaced by Exit
Exit is now the primary function to handle program exit and status code handling.
Removed Exitf, replaced by Exit and fmt.Sprintf
Exitf was removed and should be replaced by using Exit with fmt.Sprintf
// Was
check.Exitf(check.OK, "Everything is fine - answer=%d", 42)
// Now
check.Exit(check.OK, fmt.Sprintf("Everything is fine - value=%d", 42))Rework ParseBytes to return uint64 instead of interface
ParseBytes now returns an uint64 instead of an interface. The BytesIEC and BytesSI types have been replaces by functions with the same name to get a string representation of a number of unit64 bytes.
b, err := ParseBytes("2MiB")
// uint64 2 * 1024 * 1024
fmt.Println(convert.BytesIEC(b))
// "2MiB"The perfdata package was merged into the check package
// Was
perfdata := perfdata.PerfdataList{}
// Now
perfdata := check.PerfdataList{}WorstState was moved from the result to the check package
The WorstState is now in the check package. Otherwise the function has not changed.
// Was
rc = result.WorstState(states...)
// Now
rc = check.WorstState(states...)Refactored and concurrency-safe Overall
The Overall type has been overhauled.
The Add and AddSubcheck now both append a PartialResults to simplify the behavior the the internals. The Summary attribute was replaced by the OKSummary.
Overall is now concurrency-safe.
New Contributors
- @christoph2497 made their first contribution in #164
Full Changelog: v0.6.4...v1.0.0