Skip to content

Commit

Permalink
Add the exception process
Browse files Browse the repository at this point in the history
  • Loading branch information
ybkuroki committed Feb 23, 2023
1 parent 794047d commit 913740b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion util/props.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
)

const (
// CommentChar represents that the line is the comment line.
CommentChar = "#"
EqualsChar = "="
// EqualsChar represents that the equals symbol.
EqualsChar = "="
)

// ReadPropertiesFile reads a properties file and it returns a map has the keys and values in the file.
Expand All @@ -19,6 +21,7 @@ func ReadPropertiesFile(fs embed.FS, fileName string) map[string]string {
if err != nil {
return nil
}
defer file.Close()

scanner := bufio.NewScanner(file)
for scanner.Scan() {
Expand All @@ -27,6 +30,10 @@ func ReadPropertiesFile(fs embed.FS, fileName string) map[string]string {
setPorperty(line, config)
}
}
if err := scanner.Err(); err != nil {
return nil
}

return config
}

Expand Down

0 comments on commit 913740b

Please sign in to comment.