Skip to content

Commit

Permalink
refactor: cleanup store/streaming/constructor.go (backport cosmos#14044
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored and JeancarloBarrios committed Sep 28, 2024
1 parent 40fc2bf commit 6826534
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion store/streaming/constructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func NewFileStreamingService(
fileDir = path.Join(homePath, fileDir)
}

// try to create output directory if not exists.
// try to create output directory if it does not exist
if _, err := os.Stat(fileDir); os.IsNotExist(err) {
if err = os.MkdirAll(fileDir, os.ModePerm); err != nil {
return nil, err
Expand Down
14 changes: 14 additions & 0 deletions types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"time"

dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/types/kv"
)

Expand Down Expand Up @@ -89,3 +91,15 @@ func SliceContains[T comparable](elements []T, v T) bool {

return false
}

// SliceContains implements a generic function for checking if a slice contains
// a certain value.
func SliceContains[T comparable](elements []T, v T) bool {
for _, s := range elements {
if v == s {
return true
}
}

return false
}

0 comments on commit 6826534

Please sign in to comment.