mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-17 12:06:38 +02:00
Merge pull request #198 from antham/fix-various-errors
Fix various errors reported by goreportcard
This commit is contained in:
commit
584d6b241c
@ -175,7 +175,8 @@ func (c *OSCommand) Unquote(message string) string {
|
|||||||
return message
|
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)
|
f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -121,10 +121,7 @@ func LoadUserConfigFromFile(v *viper.Viper) error {
|
|||||||
folder = configDirs.QueryFolderContainsFile("config.yml")
|
folder = configDirs.QueryFolderContainsFile("config.yml")
|
||||||
}
|
}
|
||||||
v.AddConfigPath(folder.Path)
|
v.AddConfigPath(folder.Path)
|
||||||
if err := v.MergeInConfig(); err != nil {
|
return v.MergeInConfig()
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// InsertToUserConfig adds a key/value pair to the user's config and saves it
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
v.Set(key, value)
|
v.Set(key, value)
|
||||||
if err := v.WriteConfig(); err != nil {
|
return v.WriteConfig()
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDefaultConfig() []byte {
|
func getDefaultConfig() []byte {
|
||||||
|
@ -26,8 +26,6 @@ func GenerateRepo(filename string) error {
|
|||||||
if output, err := exec.Command("bash", filename).CombinedOutput(); err != nil {
|
if output, err := exec.Command("bash", filename).CombinedOutput(); err != nil {
|
||||||
return errors.New(string(output))
|
return errors.New(string(output))
|
||||||
}
|
}
|
||||||
if err := os.Chdir(testPath + "repo"); err != nil {
|
|
||||||
return err
|
return os.Chdir(testPath + "repo")
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user