Skip to content

Commit

Permalink
chore(errors): Use errors.New instead
Browse files Browse the repository at this point in the history
Calling fmt.errorf is slower and we don't need string substitution here anyway
  • Loading branch information
Ninja243 committed Oct 17, 2023
1 parent ac18955 commit 35feb88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/model.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package config

import (
"fmt"
"errors"
"log"
"time"

Expand Down Expand Up @@ -43,7 +43,7 @@ func (clouds *Clouds) SetActiveByName(name string) {

func (clouds *Clouds) FindActiveCloudConfigOrNil() (cloud *Cloud, index *int, err error) {
if clouds.NumberOfActiveCloudConfigs() > 1 {
return nil, nil, fmt.Errorf("more than one cloud active")
return nil, nil, errors.New("more than one cloud active")
}

for index, cloud := range *clouds {
Expand All @@ -52,7 +52,7 @@ func (clouds *Clouds) FindActiveCloudConfigOrNil() (cloud *Cloud, index *int, er
}
}

return nil, nil, fmt.Errorf("no active cloud")
return nil, nil, errors.New("no active cloud")
}

func (clouds *Clouds) GetActiveCloudIndex() int {
Expand Down

0 comments on commit 35feb88

Please sign in to comment.