add loading links form file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s

This commit is contained in:
Thomas Peetz
2026-10-07 18:50:09 +02:00
parent 980eda29af
commit 094dffb1c7
9 changed files with 384 additions and 172 deletions
+27
View File
@@ -0,0 +1,27 @@
package helpers
import (
"bufio"
"os"
)
func LinesInFile(fileName string) ([]string, error) {
f, err := os.Open(fileName)
if err != nil {
return nil, err
}
defer f.Close()
// Create new Scanner.
scanner := bufio.NewScanner(f)
result := []string{}
// Use Scan.
for scanner.Scan() {
line := scanner.Text()
// Append line to result.
result = append(result, line)
}
if err := scanner.Err(); err != nil {
return nil, err
}
return result, nil
}