From 428df35554f58d3a683d569ca27fc9f90fb48496 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Fri, 23 Oct 2015 15:26:21 +0200 Subject: [PATCH] Avoid exiting on error in an included files (#95) --- README.md | 2 +- pkg/config/config.go | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 707c6fc1d..0d410685f 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ Get a released version on: https://github.com/moul/advanced-ssh-config/releases ### master (unreleased) -* No entry +* Avoid exiting when an included file contains errors ([#95](https://github.com/moul/advanced-ssh-config/issues/95)) [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.1.0...master) diff --git a/pkg/config/config.go b/pkg/config/config.go index 9042a7752..70eb73786 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -257,8 +257,7 @@ func (c *Config) LoadFile(filename string) error { // Handling includes for _, include := range c.Includes { - err = c.LoadFiles(include) - if err != nil { + if err = c.LoadFiles(include); err != nil { return err } } @@ -282,9 +281,8 @@ func (c *Config) LoadFiles(pattern string) error { // Load files iteratively for _, filepath := range filepaths { - err := c.LoadFile(filepath) - if err != nil { - return err + if err := c.LoadFile(filepath); err != nil { + Logger.Warnf("Cannot include %q: %v", filepath, err) } }