fix: lint issues

Ayman Bagabas created

Change summary

cmd/soft/browse/browse.go                  |  7 +++++--
pkg/db/migrate/0003_migrate_lfs_objects.go |  8 ++++----
pkg/ssh/ssh.go                             |  2 +-
pkg/ssh/ui.go                              |  7 +++++--
pkg/ui/components/selector/selector.go     | 11 +++++++----
pkg/ui/components/tabs/tabs.go             |  6 +++++-
pkg/ui/pages/repo/repo.go                  |  9 ++++++---
7 files changed, 33 insertions(+), 17 deletions(-)

Detailed changes

cmd/soft/browse/browse.go 🔗

@@ -167,8 +167,11 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			return m, tea.Quit
 		}
 	case tea.MouseMsg:
-		switch msg.Type {
-		case tea.MouseLeft:
+		if msg.Action != tea.MouseActionPress {
+			break
+		}
+		switch msg.Button {
+		case tea.MouseButtonLeft:
 			switch {
 			case m.common.Zone.Get("footer").InBounds(msg):
 				cmds = append(cmds, footer.ToggleFooterCmd)

pkg/db/migrate/0003_migrate_lfs_objects.go 🔗

@@ -27,11 +27,11 @@ var migrateLfsObjects = Migration{
 		cfg := config.FromContext(ctx)
 		logger := log.FromContext(ctx).WithPrefix("migrate_lfs_objects")
 
-		var repoIds []int64
-		if err := tx.Select(&repoIds, "SELECT id FROM repos"); err != nil {
+		var repoIDs []int64
+		if err := tx.Select(&repoIDs, "SELECT id FROM repos"); err != nil {
 			return err
 		}
-		for _, r := range repoIds {
+		for _, r := range repoIDs {
 			var objs []models.LFSObject
 			if err := tx.Select(&objs, "SELECT * FROM lfs_objects WHERE repo_id = ?", r); err != nil {
 				return err
@@ -50,7 +50,7 @@ var migrateLfsObjects = Migration{
 		}
 		return nil
 	},
-	Rollback: func(ctx context.Context, tx *db.Tx) error {
+	Rollback: func(context.Context, *db.Tx) error {
 		return nil
 	},
 }

pkg/ssh/ssh.go 🔗

@@ -104,7 +104,7 @@ func NewSSHServer(ctx context.Context) (*SSHServer, error) {
 	}
 
 	if config.IsDebug() {
-		s.srv.ServerConfigCallback = func(ctx ssh.Context) *gossh.ServerConfig {
+		s.srv.ServerConfigCallback = func(_ ssh.Context) *gossh.ServerConfig {
 			return &gossh.ServerConfig{
 				AuthLogCallback: func(conn gossh.ConnMetadata, method string, err error) {
 					logger.Debug("authentication", "user", conn.User(), "method", method, "err", err)

pkg/ssh/ui.go 🔗

@@ -204,8 +204,11 @@ func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 				ui.showFooter = true
 			}
 		case tea.MouseMsg:
-			switch msg.Type {
-			case tea.MouseLeft:
+			if msg.Action != tea.MouseActionPress {
+				break
+			}
+			switch msg.Button {
+			case tea.MouseButtonLeft:
 				switch {
 				case ui.common.Zone.Get("footer").InBounds(msg):
 					cmds = append(cmds, footer.ToggleFooterCmd)

pkg/ui/components/selector/selector.go 🔗

@@ -231,12 +231,15 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 	cmds := make([]tea.Cmd, 0)
 	switch msg := msg.(type) {
 	case tea.MouseMsg:
-		switch msg.Type {
-		case tea.MouseWheelUp:
+		if msg.Action != tea.MouseActionPress {
+			break
+		}
+		switch msg.Button {
+		case tea.MouseButtonWheelUp:
 			s.CursorUp()
-		case tea.MouseWheelDown:
+		case tea.MouseButtonWheelDown:
 			s.CursorDown()
-		case tea.MouseLeft:
+		case tea.MouseButtonLeft:
 			curIdx := s.Index()
 			for i, item := range s.Items() {
 				item, _ := item.(IdentifiableItem)

pkg/ui/components/tabs/tabs.go 🔗

@@ -64,7 +64,11 @@ func (t *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			cmds = append(cmds, t.activeTabCmd)
 		}
 	case tea.MouseMsg:
-		if msg.Type == tea.MouseLeft {
+		if msg.Action != tea.MouseActionPress {
+			break
+		}
+		switch msg.Button {
+		case tea.MouseButtonLeft:
 			for i, tab := range t.tabs {
 				if t.common.Zone.Get(tab).InBounds(msg) {
 					t.activeTab = i

pkg/ui/pages/repo/repo.go 🔗

@@ -186,13 +186,16 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 		}
 		switch msg := msg.(type) {
 		case tea.MouseMsg:
-			switch msg.Type {
-			case tea.MouseLeft:
+			if msg.Action != tea.MouseActionPress {
+				break
+			}
+			switch msg.Button {
+			case tea.MouseButtonLeft:
 				switch {
 				case r.common.Zone.Get("repo-help").InBounds(msg):
 					cmds = append(cmds, footer.ToggleFooterCmd)
 				}
-			case tea.MouseRight:
+			case tea.MouseButtonRight:
 				switch {
 				case r.common.Zone.Get("repo-main").InBounds(msg):
 					cmds = append(cmds, goBackCmd)