Skip to content

Commit 44c703e

Browse files
fix: check for empty string before filepath.Clean
1 parent fb26cd3 commit 44c703e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ var allRules = []lint.Rule{
5454
// 2. check for conf flag
5555
// 3. load default conf
5656
func GetConfig(confFilePath string) (*lint.Config, error) {
57-
confFilePath = filepath.Clean(confFilePath)
58-
57+
// get current directory
5958
currentDir, err := os.Getwd()
6059
if err != nil {
6160
return nil, err
@@ -67,10 +66,12 @@ func GetConfig(confFilePath string) (*lint.Config, error) {
6766
confFilePath = currentDirConf
6867
}
6968

69+
// if confFilePath empty, means no config in current directory or config flag is empty
7070
if confFilePath == "" {
7171
return defConf, nil
7272
}
7373

74+
confFilePath = filepath.Clean(confFilePath)
7475
conf, err := Parse(confFilePath)
7576
if err != nil {
7677
return nil, err

0 commit comments

Comments
 (0)