filelist/*: skip empty lines (MR 41)

fixes #36
This commit is contained in:
Clayton Craft
2023-08-24 17:11:22 -07:00
parent 74de5f9798
commit 30681d2f0a
3 changed files with 20 additions and 2 deletions

View File

@@ -44,6 +44,10 @@ func (h *HookDirs) List() (*filelist.FileList, error) {
s := bufio.NewScanner(f)
for s.Scan() {
dir := s.Text()
if len(dir) == 0 {
continue
}
files.Add(dir, dir)
}
}

View File

@@ -58,7 +58,12 @@ func slurpFiles(fd io.Reader) (*filelist.FileList, error) {
s := bufio.NewScanner(fd)
for s.Scan() {
src, dest, has_dest := strings.Cut(s.Text(), ":")
line := s.Text()
if len(line) == 0 {
continue
}
src, dest, has_dest := strings.Cut(line, ":")
fFiles, err := misc.GetFiles([]string{src}, true)
if err != nil {

View File

@@ -95,6 +95,10 @@ func slurpModules(fd io.Reader, modDir string) (*filelist.FileList, error) {
s := bufio.NewScanner(fd)
for s.Scan() {
line := s.Text()
if len(line) == 0 {
continue
}
dir, file := filepath.Split(line)
if file == "" {
// item is a directory
@@ -194,7 +198,12 @@ func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) {
s := bufio.NewScanner(modulesDep)
for s.Scan() {
fields := strings.Fields(s.Text())
line := s.Text()
if len(line) == 0 {
continue
}
fields := strings.Fields(line)
if len(fields) == 0 {
continue
}