Files
gh-action-readme/internal/config_helper.go
Ismo Vuorinen 7f80105ff5 feat: go 1.25.5, dependency updates, renamed internal/errors (#129)
* feat: rename internal/errors to internal/apperrors

* fix(tests): clear env values before using in tests

* feat: rename internal/errors to internal/apperrors

* chore(deps): update go and all dependencies

* chore: remove renovate from pre-commit, formatting

* chore: sonarcloud fixes

* feat: consolidate constants to appconstants/constants.go

* chore: sonarcloud fixes

* feat: simplification, deduplication, test utils

* chore: sonarcloud fixes

* chore: sonarcloud fixes

* chore: sonarcloud fixes

* chore: sonarcloud fixes

* chore: clean up

* fix: config discovery, const deduplication

* chore: fixes
2026-01-01 23:17:29 +02:00

21 lines
524 B
Go

package internal
import (
"os"
"path/filepath"
)
// findFirstExistingConfig searches for the first existing config file
// from a list of config names within a base directory.
// Returns the full path to the first existing config file, or empty string if none exist.
func findFirstExistingConfig(basePath string, configNames []string) (string, bool) {
for _, name := range configNames {
path := filepath.Join(basePath, name)
if _, err := os.Stat(path); err == nil {
return path, true
}
}
return "", false
}