1
1
package flag
2
2
3
3
import (
4
+ "errors"
4
5
"fmt"
5
6
"strconv"
6
7
"strings"
@@ -192,10 +193,10 @@ func (f *K8sFlagGroup) ToOptions() (K8sOptions, error) {
192
193
exludeNodeLabels [excludeNodeParts [0 ]] = excludeNodeParts [1 ]
193
194
}
194
195
if len (f .ExcludeNamespaces .Value ()) > 0 && len (f .IncludeNamespaces .Value ()) > 0 {
195
- return K8sOptions {}, fmt . Errorf ("include-namespaces and exclude-namespaces flags cannot be used together" )
196
+ return K8sOptions {}, errors . New ("include-namespaces and exclude-namespaces flags cannot be used together" )
196
197
}
197
198
if len (f .ExcludeKinds .Value ()) > 0 && len (f .IncludeKinds .Value ()) > 0 {
198
- return K8sOptions {}, fmt . Errorf ("include-kinds and exclude-kinds flags cannot be used together" )
199
+ return K8sOptions {}, errors . New ("include-kinds and exclude-kinds flags cannot be used together" )
199
200
}
200
201
201
202
return K8sOptions {
@@ -222,12 +223,12 @@ func optionToTolerations(tolerationsOptions []string) ([]corev1.Toleration, erro
222
223
for _ , toleration := range tolerationsOptions {
223
224
tolerationParts := strings .Split (toleration , ":" )
224
225
if len (tolerationParts ) < 2 {
225
- return []corev1.Toleration {}, fmt . Errorf ("toleration must include key and effect" )
226
+ return []corev1.Toleration {}, errors . New ("toleration must include key and effect" )
226
227
}
227
228
if corev1 .TaintEffect (tolerationParts [1 ]) != corev1 .TaintEffectNoSchedule &&
228
229
corev1 .TaintEffect (tolerationParts [1 ]) != corev1 .TaintEffectPreferNoSchedule &&
229
230
corev1 .TaintEffect (tolerationParts [1 ]) != corev1 .TaintEffectNoExecute {
230
- return []corev1.Toleration {}, fmt . Errorf ("toleration effect must be a valid value" )
231
+ return []corev1.Toleration {}, errors . New ("toleration effect must be a valid value" )
231
232
}
232
233
keyValue := strings .Split (tolerationParts [0 ], "=" )
233
234
operator := corev1 .TolerationOpEqual
@@ -245,7 +246,7 @@ func optionToTolerations(tolerationsOptions []string) ([]corev1.Toleration, erro
245
246
if len (tolerationParts ) == 3 {
246
247
tolerationSec , err = strconv .Atoi (tolerationParts [2 ])
247
248
if err != nil {
248
- return nil , fmt . Errorf ("TolerationSeconds must must be a number" )
249
+ return nil , errors . New ("TolerationSeconds must must be a number" )
249
250
}
250
251
toleration .TolerationSeconds = lo .ToPtr (int64 (tolerationSec ))
251
252
}
0 commit comments