fix: pin golangci-lint install to commit SHA (fixes #13)
All checks were successful
check / check (push) Successful in 1m31s
All checks were successful
check / check (push) Successful in 1m31s
- Fix Dockerfile: use correct v2 module path with commit SHA (github.com/golangci/golangci-lint/v2/cmd/golangci-lint@eabc2638...) - Add CGO_ENABLED=0 for alpine compatibility - Fix 35 lint issues found by golangci-lint v2.1.6: - Remove unused nolint directives, add nolintlint where needed - Pre-allocate migrations slice - Use t.Context() instead of context.Background() in tests - Fix blank lines between comments and exported functions in ui.go
This commit is contained in:
@@ -31,7 +31,6 @@ type UI struct {
|
||||
}
|
||||
|
||||
// NewUI creates the tview-based IRC-like UI.
|
||||
|
||||
func NewUI() *UI {
|
||||
ui := &UI{
|
||||
app: tview.NewApplication(),
|
||||
@@ -50,25 +49,21 @@ func NewUI() *UI {
|
||||
}
|
||||
|
||||
// Run starts the UI event loop (blocks).
|
||||
|
||||
func (ui *UI) Run() error {
|
||||
return ui.app.Run()
|
||||
}
|
||||
|
||||
// Stop stops the UI.
|
||||
|
||||
func (ui *UI) Stop() {
|
||||
ui.app.Stop()
|
||||
}
|
||||
|
||||
// OnInput sets the callback for user input.
|
||||
|
||||
func (ui *UI) OnInput(fn func(string)) {
|
||||
ui.onInput = fn
|
||||
}
|
||||
|
||||
// AddLine adds a line to the specified buffer.
|
||||
|
||||
func (ui *UI) AddLine(bufferName string, line string) {
|
||||
ui.app.QueueUpdateDraw(func() {
|
||||
buf := ui.getOrCreateBuffer(bufferName)
|
||||
@@ -89,7 +84,6 @@ func (ui *UI) AddLine(bufferName string, line string) {
|
||||
}
|
||||
|
||||
// AddStatus adds a line to the status buffer (buffer 0).
|
||||
|
||||
func (ui *UI) AddStatus(line string) {
|
||||
ts := time.Now().Format("15:04")
|
||||
|
||||
@@ -100,7 +94,6 @@ func (ui *UI) AddStatus(line string) {
|
||||
}
|
||||
|
||||
// SwitchBuffer switches to the buffer at index n.
|
||||
|
||||
func (ui *UI) SwitchBuffer(n int) {
|
||||
ui.app.QueueUpdateDraw(func() {
|
||||
if n < 0 || n >= len(ui.buffers) {
|
||||
@@ -124,7 +117,6 @@ func (ui *UI) SwitchBuffer(n int) {
|
||||
}
|
||||
|
||||
// SwitchToBuffer switches to the named buffer, creating it
|
||||
|
||||
func (ui *UI) SwitchToBuffer(name string) {
|
||||
ui.app.QueueUpdateDraw(func() {
|
||||
buf := ui.getOrCreateBuffer(name)
|
||||
@@ -151,7 +143,6 @@ func (ui *UI) SwitchToBuffer(name string) {
|
||||
}
|
||||
|
||||
// SetStatus updates the status bar text.
|
||||
|
||||
func (ui *UI) SetStatus(
|
||||
nick, target, connStatus string,
|
||||
) {
|
||||
@@ -161,13 +152,11 @@ func (ui *UI) SetStatus(
|
||||
}
|
||||
|
||||
// BufferCount returns the number of buffers.
|
||||
|
||||
func (ui *UI) BufferCount() int {
|
||||
return len(ui.buffers)
|
||||
}
|
||||
|
||||
// BufferIndex returns the index of a named buffer, or -1.
|
||||
|
||||
func (ui *UI) BufferIndex(name string) int {
|
||||
for i, buf := range ui.buffers {
|
||||
if buf.Name == name {
|
||||
|
||||
Reference in New Issue
Block a user