1
0
mirror of https://github.com/go-task/task.git synced 2025-05-15 22:26:28 +02:00
Pete Davison 6ce798e16c
feat: experiments logging improvements (#2049)
* feat: warn when enabling inactive experiments

* feat: TASK_ environment prefix

* feat: calculate experiment enabled/active instead of storing

* refactor: rename GetTaskVar to GetTaskEnv

* feat: experiments tests
2025-02-08 23:02:51 +00:00

33 lines
546 B
Go

package experiments
import (
"fmt"
"strings"
)
type InvalidValueError struct {
Name string
AllowedValues []string
Value string
}
func (err InvalidValueError) Error() string {
return fmt.Sprintf(
"task: Experiment %q has an invalid value %q (allowed values: %s)",
err.Name,
err.Value,
strings.Join(err.AllowedValues, ", "),
)
}
type InactiveError struct {
Name string
}
func (err InactiveError) Error() string {
return fmt.Sprintf(
"task: Experiment %q is inactive and cannot be enabled",
err.Name,
)
}