gosec govulncheck runs (#1)

* gosec govulncheck runs

* Fix flaky TestRateLimiter_Matrix test

The test was failing due to two issues:
1. Test name generation used invalid character conversion (string(rune('0'+limit)))
   which produced non-printable characters for limits >= 10
2. Using 10ms windows with 100 requests caused race conditions - early requests
   would expire before all 100 were made, allowing the 101st request

Changed to use struct-based test cases with proper fmt.Sprintf naming and
a consistent 1-second window that won't expire during rapid test execution.
This commit is contained in:
2025-12-09 01:07:16 +00:00
committed by GitHub
parent 27d5011ab1
commit 29263dc8a2
17 changed files with 80 additions and 215 deletions
+3 -8
View File
@@ -354,7 +354,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.setError(fmt.Sprintf("Refresh failed: %v", msg.err))
// Mark as disconnected to trigger reconnect
m.connected = false
m.client.Close()
_ = m.client.Close()
} else {
// Always update the list, even if entries is nil/empty
m.list.SetItems(msg.entries)
@@ -603,7 +603,7 @@ func (m *Model) handleFormKey(msg tea.KeyMsg) tea.Cmd {
oldAlias := m.form.EditAlias()
return tea.Sequence(
func() tea.Msg {
m.client.Delete(oldAlias)
_ = m.client.Delete(oldAlias)
return nil
},
m.addHost(domain, ip, "", group), // Empty alias = auto-generate
@@ -678,7 +678,7 @@ func (m *Model) handlePresetFormKey(msg tea.KeyMsg) tea.Cmd {
oldName := m.presetPicker.EditName()
return tea.Sequence(
func() tea.Msg {
m.client.DeletePreset(oldName)
_ = m.client.DeletePreset(oldName)
return nil
},
m.addPreset(name, enable, disable),
@@ -1136,11 +1136,6 @@ func (m *Model) confirmDeleteView() string {
return dialogStyle.Render(sb.String())
}
// Run starts the TUI application.
func Run(socketPath string) error {
return RunWithVersion(socketPath, "dev", "", "")
}
// RunWithVersion starts the TUI application with version info for update checking.
func RunWithVersion(socketPath, version, githubOwner, githubRepo string) error {
m := NewModel(socketPath)