1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 21:02:06 -04:00

core: update to golangci-lint v2

This commit is contained in:
bbedward
2025-12-01 12:23:34 -05:00
parent 50f174be92
commit f5ca4ccce5
24 changed files with 302 additions and 274 deletions

View File

@@ -8,9 +8,9 @@ import (
)
type Request struct {
ID int `json:"id"`
Method string `json:"method"`
Params map[string]interface{} `json:"params"`
ID int `json:"id"`
Method string `json:"method"`
Params map[string]any `json:"params"`
}
func HandleRequest(conn net.Conn, req Request, manager *Manager) {
@@ -44,7 +44,7 @@ func handleOpen(conn net.Conn, req Request, manager *Manager) {
event.MimeType = mimeType
}
if categories, ok := req.Params["categories"].([]interface{}); ok {
if categories, ok := req.Params["categories"].([]any); ok {
event.Categories = make([]string, 0, len(categories))
for _, cat := range categories {
if catStr, ok := cat.(string); ok {

View File

@@ -7,9 +7,9 @@ import (
)
type Request struct {
ID int `json:"id"`
Method string `json:"method"`
Params map[string]interface{} `json:"params"`
ID int `json:"id"`
Method string `json:"method"`
Params map[string]any `json:"params"`
}
func HandleRequest(conn net.Conn, req Request, manager *Manager) {

View File

@@ -356,7 +356,7 @@ func TestHandleCreatePrinter(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.createPrinter",
Params: map[string]interface{}{
Params: map[string]any{
"name": "newprinter",
"deviceURI": "usb://HP",
"ppd": "generic.ppd",
@@ -377,10 +377,10 @@ func TestHandleCreatePrinter_MissingParams(t *testing.T) {
buf := &bytes.Buffer{}
conn := &mockConn{Buffer: buf}
req := Request{ID: 1, Method: "cups.createPrinter", Params: map[string]interface{}{}}
req := Request{ID: 1, Method: "cups.createPrinter", Params: map[string]any{}}
handleCreatePrinter(conn, req, m)
var resp models.Response[interface{}]
var resp models.Response[any]
err := json.NewDecoder(buf).Decode(&resp)
assert.NoError(t, err)
assert.Nil(t, resp.Result)
@@ -399,7 +399,7 @@ func TestHandleDeletePrinter(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.deletePrinter",
Params: map[string]interface{}{"printerName": "printer1"},
Params: map[string]any{"printerName": "printer1"},
}
handleDeletePrinter(conn, req, m)
@@ -422,7 +422,7 @@ func TestHandleAcceptJobs(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.acceptJobs",
Params: map[string]interface{}{"printerName": "printer1"},
Params: map[string]any{"printerName": "printer1"},
}
handleAcceptJobs(conn, req, m)
@@ -445,7 +445,7 @@ func TestHandleRejectJobs(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.rejectJobs",
Params: map[string]interface{}{"printerName": "printer1"},
Params: map[string]any{"printerName": "printer1"},
}
handleRejectJobs(conn, req, m)
@@ -468,7 +468,7 @@ func TestHandleSetPrinterShared(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.setPrinterShared",
Params: map[string]interface{}{"printerName": "printer1", "shared": true},
Params: map[string]any{"printerName": "printer1", "shared": true},
}
handleSetPrinterShared(conn, req, m)
@@ -491,7 +491,7 @@ func TestHandleSetPrinterLocation(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.setPrinterLocation",
Params: map[string]interface{}{"printerName": "printer1", "location": "Office"},
Params: map[string]any{"printerName": "printer1", "location": "Office"},
}
handleSetPrinterLocation(conn, req, m)
@@ -514,7 +514,7 @@ func TestHandleSetPrinterInfo(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.setPrinterInfo",
Params: map[string]interface{}{"printerName": "printer1", "info": "Main Printer"},
Params: map[string]any{"printerName": "printer1", "info": "Main Printer"},
}
handleSetPrinterInfo(conn, req, m)
@@ -537,7 +537,7 @@ func TestHandleMoveJob(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.moveJob",
Params: map[string]interface{}{"jobID": float64(1), "destPrinter": "printer2"},
Params: map[string]any{"jobID": float64(1), "destPrinter": "printer2"},
}
handleMoveJob(conn, req, m)
@@ -560,7 +560,7 @@ func TestHandlePrintTestPage(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.printTestPage",
Params: map[string]interface{}{"printerName": "printer1"},
Params: map[string]any{"printerName": "printer1"},
}
handlePrintTestPage(conn, req, m)
@@ -584,7 +584,7 @@ func TestHandleAddPrinterToClass(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.addPrinterToClass",
Params: map[string]interface{}{"className": "office", "printerName": "printer1"},
Params: map[string]any{"className": "office", "printerName": "printer1"},
}
handleAddPrinterToClass(conn, req, m)
@@ -607,7 +607,7 @@ func TestHandleRemovePrinterFromClass(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.removePrinterFromClass",
Params: map[string]interface{}{"className": "office", "printerName": "printer1"},
Params: map[string]any{"className": "office", "printerName": "printer1"},
}
handleRemovePrinterFromClass(conn, req, m)
@@ -630,7 +630,7 @@ func TestHandleDeleteClass(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.deleteClass",
Params: map[string]interface{}{"className": "office"},
Params: map[string]any{"className": "office"},
}
handleDeleteClass(conn, req, m)
@@ -653,7 +653,7 @@ func TestHandleRestartJob(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.restartJob",
Params: map[string]interface{}{"jobID": float64(1)},
Params: map[string]any{"jobID": float64(1)},
}
handleRestartJob(conn, req, m)
@@ -676,7 +676,7 @@ func TestHandleHoldJob(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.holdJob",
Params: map[string]interface{}{"jobID": float64(1)},
Params: map[string]any{"jobID": float64(1)},
}
handleHoldJob(conn, req, m)
@@ -699,7 +699,7 @@ func TestHandleHoldJob_WithHoldUntil(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.holdJob",
Params: map[string]interface{}{"jobID": float64(1), "holdUntil": "no-hold"},
Params: map[string]any{"jobID": float64(1), "holdUntil": "no-hold"},
}
handleHoldJob(conn, req, m)

View File

@@ -167,7 +167,7 @@ func (p *DBusPkHelper) JobSetHoldUntil(jobID int, holdUntil string) error {
return p.callSimple("JobSetHoldUntil", int32(jobID), holdUntil)
}
func (p *DBusPkHelper) callSimple(method string, args ...interface{}) error {
func (p *DBusPkHelper) callSimple(method string, args ...any) error {
var errStr string
call := p.obj.Call(pkHelperInterface+"."+method, 0, args...)

View File

@@ -1346,7 +1346,7 @@ func Start(printDocs bool) error {
if wlContext != nil {
go func() {
err := <-wlContext.FatalError()
fatalErrChan <- fmt.Errorf("Wayland context fatal error: %w", err)
fatalErrChan <- fmt.Errorf("wayland context fatal error: %w", err)
}()
}

View File

@@ -78,7 +78,7 @@ func NewManager(display *wlclient.Display, config Config) (*Manager, error) {
log.Info("Gamma control enabled at startup, initializing controls")
gammaMgr := m.gammaControl.(*wlr_gamma_control.ZwlrGammaControlManagerV1)
if err := func() error {
var outputs []*wlclient.Output = m.availableOutputs
outputs := m.availableOutputs
return m.setupOutputControls(outputs, gammaMgr)
}(); err != nil {
log.Errorf("Failed to initialize gamma controls: %v", err)
@@ -573,6 +573,7 @@ func (m *Manager) transitionWorker() {
log.Debugf("Starting smooth transition: %dK -> %dK over %v", currentTemp, targetTemp, dur)
stepLoop:
for i := 0; i <= steps; i++ {
select {
case newTarget := <-m.transitionChan:
@@ -580,7 +581,7 @@ func (m *Manager) transitionWorker() {
m.targetTemp = newTarget
m.transitionMutex.Unlock()
log.Debugf("Transition %dK -> %dK aborted (newer transition started)", currentTemp, targetTemp)
break
break stepLoop
default:
}
@@ -1214,7 +1215,7 @@ func (m *Manager) SetEnabled(enabled bool) {
log.Info("Creating gamma controls")
gammaMgr := m.gammaControl.(*wlr_gamma_control.ZwlrGammaControlManagerV1)
if err := func() error {
var outputs []*wlclient.Output = m.availableOutputs
outputs := m.availableOutputs
return m.setupOutputControls(outputs, gammaMgr)
}(); err != nil {
log.Errorf("Failed to create gamma controls: %v", err)