v0.7.1
Some checks failed
ci/woodpecker/push/publish-docs Pipeline was successful
ci/woodpecker/tag/gitea Pipeline failed
ci/woodpecker/tag/publish-docs Pipeline was successful

This commit is contained in:
Andrew Woodlee 2025-02-14 11:56:46 -06:00
parent f84d76badf
commit 932d5c380f
4 changed files with 14 additions and 8 deletions

3
.changes/v0.7.1.md Normal file
View File

@ -0,0 +1,3 @@
## v0.7.1 - 2025-02-14
### Fixed
* Incorrect local config file loading logic caused files to not be detected

View File

@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie). and is generated by [Changie](https://github.com/miniscruff/changie).
## v0.7.1 - 2025-02-14
### Fixed
* Incorrect local config file loading logic caused files to not be detected
## v0.7.0 - 2025-02-11 ## v0.7.0 - 2025-02-11
### Added ### Added
* [feat]: package `packageOperation` option `checkVersion` implemented * [feat]: package `packageOperation` option `checkVersion` implemented

View File

@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
const versionStr = "0.7.0" const versionStr = "0.7.1"
var ( var (
versionCmd = &cobra.Command{ versionCmd = &cobra.Command{

View File

@ -85,7 +85,6 @@ func (opts *ConfigOpts) InitConfig() {
if err != nil { if err != nil {
logging.ExitWithMSG(fmt.Sprintf("error initializing config fetcher: %v", err), 1, nil) logging.ExitWithMSG(fmt.Sprintf("error initializing config fetcher: %v", err), 1, nil)
} }
if opts.ConfigFilePath != "" { if opts.ConfigFilePath != "" {
loadConfigFile(fetcher, opts.ConfigFilePath, backyKoanf, opts) loadConfigFile(fetcher, opts.ConfigFilePath, backyKoanf, opts)
} else { } else {
@ -109,22 +108,22 @@ func loadConfigFile(fetcher remotefetcher.RemoteFetcher, filePath string, k *koa
func loadDefaultConfigFiles(fetcher remotefetcher.RemoteFetcher, configFiles []string, k *koanf.Koanf, opts *ConfigOpts) { func loadDefaultConfigFiles(fetcher remotefetcher.RemoteFetcher, configFiles []string, k *koanf.Koanf, opts *ConfigOpts) {
cFileFailures := 0 cFileFailures := 0
for _, c := range configFiles { for _, c := range configFiles {
opts.ConfigFilePath = c
data, err := fetcher.Fetch(c) data, err := fetcher.Fetch(c)
if err != nil { if err != nil {
cFileFailures++ cFileFailures++
continue continue
} }
if err := k.Load(rawbytes.Provider(data), yaml.Parser()); err != nil { if data != nil {
cFileFailures++ if err := k.Load(rawbytes.Provider(data), yaml.Parser()); err == nil {
continue continue
}
} }
break
} }
if cFileFailures == len(configFiles) { if cFileFailures == len(configFiles) {
logging.ExitWithMSG("Could not find any valid config file", 1, nil) logging.ExitWithMSG("Could not find any valid local config file", 1, nil)
} }
} }