diff --git a/git/git.go b/git/git.go index 748678f98c315d5e0b7cb09ad74268805867a490..074cbf83b8c94abcf7ed14886f96d62ffe463616 100644 --- a/git/git.go +++ b/git/git.go @@ -154,11 +154,11 @@ func (r *Repo) LatestFile(path string) (string, error) { } f, err := c.File(path) if err != nil { - return "", nil + return "", err } content, err := f.Contents() if err != nil { - return "", nil + return "", err } return content, nil } diff --git a/tui/session.go b/tui/session.go index 648307358c4cefc8a2cd9ffe512d08780be8eaa0..78ed852cddbea2cceee98d2015aac07b18c58e52 100644 --- a/tui/session.go +++ b/tui/session.go @@ -22,9 +22,7 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session) } appCfg, err := loadConfig(rs) if err != nil { - if err != nil { - log.Printf("cannot load config: %s", err) - } + log.Printf("cannot load config: %s", err) } return func(s ssh.Session) (tea.Model, []tea.ProgramOption) { @@ -38,9 +36,7 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session) } cfg, err := loadConfig(rs) if err != nil { - if err != nil { - log.Printf("cannot load config: %s", err) - } + log.Printf("cannot load config: %s", err) } appCfg = cfg log.Printf("Repo bubble loaded in %s", time.Since(ct)) @@ -70,11 +66,11 @@ func loadConfig(rs *git.RepoSource) (*Config, error) { cfg.RepoSource = rs cr, err := rs.GetRepo("config") if err != nil { - return nil, fmt.Errorf("cannot load config repo: %s", err) + return nil, err } cs, err := cr.LatestFile("config.json") if err != nil { - return nil, fmt.Errorf("cannot load config.json: %s", err) + return nil, err } err = json.Unmarshal([]byte(cs), cfg) if err != nil {