-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: WithScanPath unexpected results (#65)
* fix: issue #64 * fix: removed debug log Co-authored-by: Britton Hayes <[email protected]>
- Loading branch information
1 parent
6b39bd2
commit 2b166cd
Showing
2 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
package validate | ||
|
||
import ( | ||
"github.com/rs/zerolog/log" | ||
|
||
"github.com/spf13/afero" | ||
"os" | ||
) | ||
|
||
// Path checks if a file at the given path exists and returns it if so, | ||
// PathExists checks if a file at the given path exists and returns it if so, | ||
// otherwise returns a default path. | ||
func Path(fs afero.Fs, path string) string { | ||
ok, err := afero.Exists(fs, path) | ||
if err != nil { | ||
log.Fatal().Err(err).Send() | ||
} | ||
|
||
if ok { | ||
return path | ||
} | ||
|
||
log.Fatal().Msg("no valid path provided") | ||
return "." | ||
func PathExists(path string) bool { | ||
_, err := os.Stat(path) | ||
return err == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters