Join webbapp core modules into single package

This commit is contained in:
eleksir
2025-10-12 16:42:16 +03:00
parent 3932835d47
commit d5c6d5719a
12 changed files with 203 additions and 176 deletions

View File

@@ -0,0 +1,36 @@
package webapp
import (
"aleesa-webapp-go/internal/log"
"bufio"
"os"
)
// ReadLines читает даденный файл построчно в массив строк.
func ReadLines(path string) ([]string, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer func(file *os.File) {
err := file.Close()
if err != nil {
log.Errorf("Unable to close file %s:%s", path, err)
}
}(file)
var (
lines []string
scanner = bufio.NewScanner(file)
)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
return lines, scanner.Err()
}
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */