Skip to content

Commit

Permalink
refactor: using slices.Contains to simplify the code (#2552)
Browse files Browse the repository at this point in the history
Signed-off-by: dashangcun <907225865@qq.com>
Co-authored-by: arturrez <56270896+arturrez@users.noreply.github.com>
Co-authored-by: felipemadero <felipe.madero@gmail.com>
  • Loading branch information
3 people authored and owenwahlgren committed Jan 23, 2025
1 parent 9428410 commit de11ecc
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/subnet/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"regexp"
"slices"
"strings"

"github.com/ava-labs/avalanche-cli/pkg/ux"
Expand Down Expand Up @@ -120,11 +121,5 @@ func removeTimestamp(s string) string {
// if an error has already been found, we should not print it again
func alreadyFound(s string, found []string) bool {
log := removeTimestamp(s)
for _, f := range found {
// this is a pretty strict requirement, but probably justified
if f == log {
return true
}
}
return false
return slices.Contains(found, log)
}

0 comments on commit de11ecc

Please sign in to comment.