Skip to content

Commit

Permalink
Merge pull request #330 from metrumresearchgroup/lint-fixes
Browse files Browse the repository at this point in the history
ci: fix lint workflow
  • Loading branch information
kyleam authored Aug 23, 2024
2 parents 7d5e572 + 0c79738 commit dc9e22c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
22 changes: 20 additions & 2 deletions cmd/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ package cmd

import (
"fmt"
"io/ioutil"
"io/fs"
"os"
"path/filepath"
"runtime"
"sort"
Expand Down Expand Up @@ -221,13 +222,30 @@ func sortParams(params []string) []string {
return sorted
}

func readDir(dirname string) ([]fs.FileInfo, error) {
entries, err := os.ReadDir(dirname)
if err != nil {
return nil, err
}
infos := make([]fs.FileInfo, 0, len(entries))
for _, entry := range entries {
info, err := entry.Info()
if err != nil {
return infos, err
}
infos = append(infos, info)
}

return infos, nil
}

func params(cmd *cobra.Command, args []string) {
if debug {
viper.Debug()
}
var modelDirs []string
if dir != "" {
fi, err := ioutil.ReadDir(dir)
fi, err := readDir(dir)
if err != nil {
log.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func NewRootCmd() *cobra.Command {
}

// Set random for application
rand.Seed(time.Now().UnixNano())
// TODO: Remove Seed call once minimum Go is 1.20 (SA1019).
rand.Seed(time.Now().UnixNano()) //nolint:staticcheck

cobra.OnInitialize(initConfig)

Expand Down

0 comments on commit dc9e22c

Please sign in to comment.