mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-06-30 05:44:37 +00:00
chore: add golangci-lint v2 config and fix linter warnings (#46)
- [x] Add golangci-lint v2 configuration with formatters section - [x] Reorganize linters-settings under linters section - [x] Replace if-else chains with switch statements for clarity - [x] Wrap all ignored error returns with `_ = ` pattern - [x] Add OSC 8 hyperlink helper function for clickable ports - [x] Add blank line in table styling function - [x] Remove unnecessary type assertion in test
This commit is contained in:
@@ -564,6 +564,11 @@ func (m model) buildTableRows() [][]string {
|
||||
|
||||
statusIcon, statusText := m.getStatusIconAndText(id, fwd)
|
||||
|
||||
localPortText := fmt.Sprintf("%d", fwd.LocalPort)
|
||||
if fwd.Status == "Active" && !m.ui.isForwardDisabled(id) {
|
||||
localPortText = hyperlink(fmt.Sprintf("http://127.0.0.1:%d", fwd.LocalPort), fmt.Sprintf("%d→", fwd.LocalPort))
|
||||
}
|
||||
|
||||
rows = append(rows, []string{
|
||||
truncate(fwd.Context, ColumnWidthContext),
|
||||
truncate(fwd.Namespace, ColumnWidthNamespace),
|
||||
@@ -571,7 +576,7 @@ func (m model) buildTableRows() [][]string {
|
||||
truncate(fwd.Type, ColumnWidthType),
|
||||
truncate(fwd.Resource, ColumnWidthResource),
|
||||
fmt.Sprintf("%d", fwd.RemotePort),
|
||||
fmt.Sprintf("%d", fwd.LocalPort),
|
||||
localPortText,
|
||||
statusIcon + " " + statusText,
|
||||
})
|
||||
}
|
||||
@@ -642,6 +647,7 @@ func (m model) createTableStyleFunc(colors mainViewColors) func(row, col int) li
|
||||
return baseStyle.Foreground(colors.errorColor)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return baseStyle
|
||||
|
||||
Reference in New Issue
Block a user