6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-10 15:29:19 +00:00

Fix issues found by goerrcheck linter

This commit is contained in:
Grzegorz Dlugoszewski
2025-08-24 16:33:15 +02:00
parent 599643892b
commit 1e1584ba33
6 changed files with 35 additions and 16 deletions

View File

@@ -92,7 +92,11 @@ func readGitconfig(cfg Gitconfig) {
}
viper.SetConfigType("env")
viper.ReadConfig(bytes.NewBuffer([]byte(strings.Join(lines, "\n"))))
if err := viper.ReadConfig(bytes.NewBuffer([]byte(strings.Join(lines, "\n")))); err != nil {
// Log error but don't fail - configuration is optional
fmt.Fprintf(os.Stderr, "Warning: failed to read git config: %v\n", err)
}
// TODO: A hacky way to read boolean flag from gitconfig. Find a cleaner way.
if val := cfg.Get(fmt.Sprintf("%s.%s", GitgetPrefix, KeySkipHost)); strings.ToLower(val) == "true" {