fix: lint issues, linter config (#505)

This commit is contained in:
Carlos Alexandro Becker 2024-03-01 10:32:02 -03:00 committed by GitHub
parent 491042b25f
commit 5951e0612f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View file

@ -23,7 +23,7 @@ linters:
- gomnd - gomnd
- gomoddirectives - gomoddirectives
- goprintffuncname - goprintffuncname
- ifshort # - ifshort
# - lll # - lll
- misspell - misspell
- nakedret - nakedret
@ -43,5 +43,4 @@ linters:
- staticcheck - staticcheck
- structcheck - structcheck
- typecheck - typecheck
- unused
- varcheck - varcheck

View file

@ -56,7 +56,7 @@ func (o Options) Run() error {
if err != nil { if err != nil {
return fmt.Errorf("invalid data provided") return fmt.Errorf("invalid data provided")
} }
var columns = make([]table.Column, 0, len(columnNames)) columns := make([]table.Column, 0, len(columnNames))
for i, title := range columnNames { for i, title := range columnNames {
width := lipgloss.Width(title) width := lipgloss.Width(title)
@ -77,7 +77,7 @@ func (o Options) Run() error {
Selected: o.SelectedStyle.ToLipgloss(), Selected: o.SelectedStyle.ToLipgloss(),
} }
var rows = make([]table.Row, 0, len(data)) rows := make([]table.Row, 0, len(data))
for _, row := range data { for _, row := range data {
if len(row) > len(columns) { if len(row) > len(columns) {
return fmt.Errorf("invalid number of columns") return fmt.Errorf("invalid number of columns")
@ -91,7 +91,7 @@ func (o Options) Run() error {
Rows(data...). Rows(data...).
BorderStyle(o.BorderStyle.ToLipgloss()). BorderStyle(o.BorderStyle.ToLipgloss()).
Border(style.Border[o.Border]). Border(style.Border[o.Border]).
StyleFunc(func(row, col int) lipgloss.Style { StyleFunc(func(row, _ int) lipgloss.Style {
if row == 0 { if row == 0 {
return styles.Header return styles.Header
} }
@ -111,7 +111,6 @@ func (o Options) Run() error {
) )
tm, err := tea.NewProgram(model{table: table}, tea.WithOutput(os.Stderr)).Run() tm, err := tea.NewProgram(model{table: table}, tea.WithOutput(os.Stderr)).Run()
if err != nil { if err != nil {
return fmt.Errorf("failed to start tea program: %w", err) return fmt.Errorf("failed to start tea program: %w", err)
} }