micrach/files/get_files_in_folder.go
Yanislav Igonin db8a46cdf1
build: modernize Wave 1 baseline (#16)
* chore: add agents md

* docs: expand repository and setup guides

* docs: plan project modernization

* docs: add Wave 1 implementation plan

* test: characterize legacy behavior

* build: update Go and Fiber v2

* fix(gateway): preserve duplicate auth behavior

* refactor(db): migrate to pgx v5

* refactor: replace deprecated I/O APIs

* build: add local PostgreSQL compose

* build: add multi-stage image

* ci: replace legacy deployment workflow

* fix(deps): update vulnerable Go modules

* docs: document modern development workflow
2026-07-16 16:08:54 +09:00

40 lines
694 B
Go

package files
import (
"log"
"os"
"path"
)
// Reads folder and returns full file paths slice
func GetFullFilePathsInFolder(folder string) []string {
currentPath, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
fullFolderPath := path.Join(currentPath, folder)
files, err := os.ReadDir(fullFolderPath)
if err != nil {
log.Fatal(err)
}
var paths []string
for _, file := range files {
paths = append(paths, path.Join(fullFolderPath, file.Name()))
}
return paths
}
// Reads file contents by full path and returns string
func ReadFileText(fullFilePath string) string {
file, err := os.ReadFile(fullFilePath)
if err != nil {
log.Fatal(err)
}
return string(file)
}