mirror of
https://github.com/go-task/task.git
synced 2025-05-15 22:26:28 +02:00
* 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
33 lines
546 B
Go
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,
|
|
)
|
|
}
|