features: print warning for stable/depreacted feature flags

This commit is contained in:
Michael Eischer 2024-02-17 21:50:25 +01:00
parent fe68d2cafb
commit a9b64cd7ad
4 changed files with 35 additions and 17 deletions

View file

@ -15,13 +15,17 @@ import (
func TestSetFlag(t *testing.T, f *FlagSet, flag FlagName, value bool) func() {
current := f.Enabled(flag)
if err := f.Apply(fmt.Sprintf("%s=%v", flag, value)); err != nil {
panicIfCalled := func(msg string) {
panic(msg)
}
if err := f.Apply(fmt.Sprintf("%s=%v", flag, value), panicIfCalled); err != nil {
// not reachable
panic(err)
}
return func() {
if err := f.Apply(fmt.Sprintf("%s=%v", flag, current)); err != nil {
if err := f.Apply(fmt.Sprintf("%s=%v", flag, current), panicIfCalled); err != nil {
// not reachable
panic(err)
}