21 lines
352 B
Go
21 lines
352 B
Go
package splitter
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func SplitFile(path string) []string {
|
|
fileContent := getFileContent(path)
|
|
return strings.Fields(fileContent)
|
|
}
|
|
|
|
func getFileContent(path string) string{
|
|
data, err := os.ReadFile(path)
|
|
if err != nil {
|
|
panic(fmt.Errorf("Content of File could not be found %s", path))
|
|
}
|
|
return string(data)
|
|
}
|