Fix code analyzer warnings
This commit is contained in:
parent
5f9cc58ef7
commit
888ee5ea4a
@ -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)
|
||||
}
|
||||
|
3
internal/cache/cache.go
vendored
3
internal/cache/cache.go
vendored
@ -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() {
|
||||
|
5
internal/cache/cache_aliases.go
vendored
5
internal/cache/cache_aliases.go
vendored
@ -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,
|
||||
|
2
internal/cache/projects_fs.go
vendored
2
internal/cache/projects_fs.go
vendored
@ -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
|
||||
|
3
internal/cache/projects_git.go
vendored
3
internal/cache/projects_git.go
vendored
@ -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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user