Skip to content

Commit

Permalink
Calc: fix config validation
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Sep 18, 2022
1 parent 831f27b commit 91e1cea
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions provider/calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ func NewCalcFromConfig(other map[string]interface{}) (IntProvider, error) {

o := &calcProvider{}

if len(cc.Add) > 0 && len(cc.Mul) > 0 {
return nil, errors.New("can only have either add or mul")
}

if len(cc.Add) > 0 || len(cc.Mul) > 0 && cc.Sign != nil {
return nil, errors.New("can only have either add/mul or sign")
if len(cc.Add) > 0 && len(cc.Mul) > 0 || len(cc.Add) > 0 && cc.Sign != nil || len(cc.Mul) > 0 && cc.Sign != nil {
return nil, errors.New("can only have either add, mul or sign")
}

for idx, cc := range cc.Add {
Expand Down

0 comments on commit 91e1cea

Please sign in to comment.