diff --git a/cmd/util_fzf.go b/cmd/util_fzf.go index 2a9def5..902b1f9 100644 --- a/cmd/util_fzf.go +++ b/cmd/util_fzf.go @@ -156,7 +156,7 @@ func fzfProjectFromProjects(opts *fzfProjectOpts, projects []*projects.Project) return projects[i], nil } -func fzfPreviewWindow(i, w, h int) string { +func fzfPreviewWindow(i, _, _ int) string { p := projectCache.Projects[i] return projectCache.ProjectString(p) } diff --git a/internal/cache/cache.go b/internal/cache/cache.go index ae4920e..6aa51b9 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -67,11 +67,10 @@ func (c *Cache) LockCache() { c.checkLock() file, err := os.OpenFile(c.file+".lock", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o640) - defer file.Close() - if err != nil { c.log.Fatal("Failed to lock cache", c.log.Args("error", err)) } + file.Close() } func (c *Cache) checkLock() { diff --git a/internal/cache/cache_aliases.go b/internal/cache/cache_aliases.go index dbe6701..89e4698 100644 --- a/internal/cache/cache_aliases.go +++ b/internal/cache/cache_aliases.go @@ -3,8 +3,9 @@ package cache import ( "errors" - "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/projects" "golang.org/x/exp/slices" + + "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/projects" ) func (c *Cache) deleteAlias(alias *ProjectAlias) { @@ -23,7 +24,7 @@ func (c *Cache) DeleteAlias(alias *ProjectAlias) { func (c *Cache) addAlias(alias string, projectID int, remote string) error { if c.GetAliasByName(alias) != nil { - return errors.New("Failed to add alias, already exists") + return errors.New("failed to add alias, already exists") } c.Aliases = append(c.Aliases, diff --git a/internal/cache/projects_fs.go b/internal/cache/projects_fs.go index 0f045c8..8fda920 100644 --- a/internal/cache/projects_fs.go +++ b/internal/cache/projects_fs.go @@ -32,7 +32,7 @@ func (c *Cache) GetProjectFromCwd() (*projects.Project, error) { if err != nil { return project, err } else if !strings.HasPrefix(cwd, c.path) { - return project, errors.New("Not in any project path") + return project, errors.New("not in any project path") } // Strip projects dir from path diff --git a/internal/cache/projects_git.go b/internal/cache/projects_git.go index 3eec1a4..4d1bc1d 100644 --- a/internal/cache/projects_git.go +++ b/internal/cache/projects_git.go @@ -5,6 +5,7 @@ import ( "time" git "github.com/go-git/go-git/v5" + "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/projects" ) @@ -31,7 +32,7 @@ func (c *Cache) OpenProject(ctx context.Context, project *projects.Project) *git // Check to make sure we can connect before we time out // shouldn't be necessary, but go-git does not properly // honor its context - if err := project.CheckHost(projects.GitProtoSSH); err != nil { + if err = project.CheckHost(projects.GitProtoSSH); err != nil { c.log.Fatal("Git remote unreachable, giving up", c.log.Args("error", err)) }