From 996a961865892d8b81ae3adccb482161e6994c41 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 2 Apr 2025 05:50:21 -0700 Subject: pkg/fuzzer/queue: add Status.String Otherwise it's hard to understand in error messages what 1/2/3 mean. --- pkg/fuzzer/queue/queue.go | 1 + pkg/fuzzer/queue/status_string.go | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkg/fuzzer/queue/status_string.go (limited to 'pkg/fuzzer/queue') diff --git a/pkg/fuzzer/queue/queue.go b/pkg/fuzzer/queue/queue.go index 37e69837f..ca2d76092 100644 --- a/pkg/fuzzer/queue/queue.go +++ b/pkg/fuzzer/queue/queue.go @@ -213,6 +213,7 @@ func (r *Result) GlobFiles() []string { type Status int +//go:generate go run golang.org/x/tools/cmd/stringer -type Status const ( Success Status = iota ExecFailure // For e.g. serialization errors. diff --git a/pkg/fuzzer/queue/status_string.go b/pkg/fuzzer/queue/status_string.go new file mode 100644 index 000000000..91ecb497e --- /dev/null +++ b/pkg/fuzzer/queue/status_string.go @@ -0,0 +1,27 @@ +// Code generated by "stringer -type Status"; DO NOT EDIT. + +package queue + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[Success-0] + _ = x[ExecFailure-1] + _ = x[Crashed-2] + _ = x[Restarted-3] + _ = x[Hanged-4] +} + +const _Status_name = "SuccessExecFailureCrashedRestartedHanged" + +var _Status_index = [...]uint8{0, 7, 18, 25, 34, 40} + +func (i Status) String() string { + if i < 0 || i >= Status(len(_Status_index)-1) { + return "Status(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Status_name[_Status_index[i]:_Status_index[i+1]] +} -- cgit mrf-deployment