Skip to content

Commit

Permalink
Typo errors and better debug messages.
Browse files Browse the repository at this point in the history
Signed-off-by: David F D Reis <[email protected]>
  • Loading branch information
davidfdr authored and jt-nti committed Mar 26, 2024
1 parent 2192bbd commit 7b1e278
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions internal/util/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func CopyIndexFiles(logger *log.CmdLogger, src, dest string) error {

opt := copy.Options{
Skip: func(_ os.FileInfo, src, _ string) (bool, error) {
logger.Debugf("Source folder to check and skip copy: %s", src)
logger.Debugf("Checking source copy path: %s", src)
fileInfo, err := os.Lstat(src)
if err != nil {
return true, fmt.Errorf(
Expand All @@ -77,11 +77,16 @@ func CopyIndexFiles(logger *log.CmdLogger, src, dest string) error {
)
}
if fileInfo.IsDir() { // copy it recursively
logger.Debugf("This is a folder: %s", src)
logger.Debugf("This is a folder, copying: %s", src)
return false, nil

Check failure on line 81 in internal/util/copy.go

View workflow job for this annotation

GitHub Actions / lint

return with no blank line before (nlreturn)
} else { // any file that will not be a JSON will be skipped
logger.Debugf("This is a file: %s", src)
return !strings.HasSuffix(src, ".json"), nil
} else { // any non JSON will be skipped

Check warning on line 82 in internal/util/copy.go

View workflow job for this annotation

GitHub Actions / lint

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
isJsonFile := strings.HasSuffix(src, ".json")

Check warning on line 83 in internal/util/copy.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: var isJsonFile should be isJSONFile (revive)
if isJsonFile {
logger.Debugf("This is a JSON file, copying: %s", src)
} else {
logger.Debugf("This is NOT a JSON file, skipping copy: %s", src)
}
return !isJsonFile, nil

Check failure on line 89 in internal/util/copy.go

View workflow job for this annotation

GitHub Actions / lint

return with no blank line before (nlreturn)
}
},
}
Expand Down

0 comments on commit 7b1e278

Please sign in to comment.