From 810155ef2f8c1e34c3f67aa95dbde9dcb342bb8a Mon Sep 17 00:00:00 2001 From: Anthony HAMON Date: Tue, 21 Aug 2018 08:40:51 +0200 Subject: [PATCH 1/2] fix documentation and reference issues --- pkg/commands/os.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 9756d619d..18ff93cc6 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -175,7 +175,8 @@ func (c *OSCommand) Unquote(message string) string { return message } -func (C *OSCommand) AppendLineToFile(filename, line string) error { +// AppendLineToFile adds a new line in file +func (c *OSCommand) AppendLineToFile(filename, line string) error { f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) if err != nil { return err From 37681627ab46bc97af6cffcc812dadfe98c0852b Mon Sep 17 00:00:00 2001 From: Anthony HAMON Date: Tue, 21 Aug 2018 08:41:31 +0200 Subject: [PATCH 2/2] remove useless check --- pkg/config/app_config.go | 10 ++-------- pkg/test/test.go | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 9f258d4a6..aa56365e3 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -121,10 +121,7 @@ func LoadUserConfigFromFile(v *viper.Viper) error { folder = configDirs.QueryFolderContainsFile("config.yml") } v.AddConfigPath(folder.Path) - if err := v.MergeInConfig(); err != nil { - return err - } - return nil + return v.MergeInConfig() } // InsertToUserConfig adds a key/value pair to the user's config and saves it @@ -139,10 +136,7 @@ func (c *AppConfig) InsertToUserConfig(key, value string) error { return err } v.Set(key, value) - if err := v.WriteConfig(); err != nil { - return err - } - return nil + return v.WriteConfig() } func getDefaultConfig() []byte { diff --git a/pkg/test/test.go b/pkg/test/test.go index 7bdbd4c10..b5da22903 100644 --- a/pkg/test/test.go +++ b/pkg/test/test.go @@ -18,8 +18,6 @@ func GenerateRepo(filename string) error { if output, err := exec.Command("bash", filename).CombinedOutput(); err != nil { return errors.New(string(output)) } - if err := os.Chdir(testPath + "repo"); err != nil { - return err - } - return nil + + return os.Chdir(testPath + "repo") }