refactor: extract read all text method to file package
This commit is contained in:
@@ -24,3 +24,13 @@ func ReadLines(filePath string) []string {
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
func ReadAllText(filePath string) string {
|
||||
fileContent, readErr := os.ReadFile(filePath)
|
||||
|
||||
if readErr != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return string(fileContent)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user