1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

core: replace all use of interface{} with any (#848)

This commit is contained in:
Marcus Ramberg
2025-12-01 17:04:37 +01:00
committed by GitHub
parent cfc07f4411
commit 94851a51aa
60 changed files with 336 additions and 334 deletions

View File

@@ -9,9 +9,9 @@ import (
)
type Request struct {
ID int `json:"id,omitempty"`
Method string `json:"method"`
Params map[string]interface{} `json:"params,omitempty"`
ID int `json:"id,omitempty"`
Method string `json:"method"`
Params map[string]any `json:"params,omitempty"`
}
type SuccessResult struct {

View File

@@ -75,7 +75,7 @@ func TestHandleGetPrinters_Error(t *testing.T) {
handleGetPrinters(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)
@@ -103,7 +103,7 @@ func TestHandleGetJobs(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.getJobs",
Params: map[string]interface{}{
Params: map[string]any{
"printerName": "printer1",
},
}
@@ -130,12 +130,12 @@ func TestHandleGetJobs_MissingParam(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.getJobs",
Params: map[string]interface{}{},
Params: map[string]any{},
}
handleGetJobs(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)
@@ -155,7 +155,7 @@ func TestHandlePausePrinter(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.pausePrinter",
Params: map[string]interface{}{
Params: map[string]any{
"printerName": "printer1",
},
}
@@ -182,7 +182,7 @@ func TestHandleResumePrinter(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.resumePrinter",
Params: map[string]interface{}{
Params: map[string]any{
"printerName": "printer1",
},
}
@@ -209,7 +209,7 @@ func TestHandleCancelJob(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.cancelJob",
Params: map[string]interface{}{
Params: map[string]any{
"jobID": float64(1),
},
}
@@ -236,7 +236,7 @@ func TestHandlePurgeJobs(t *testing.T) {
req := Request{
ID: 1,
Method: "cups.purgeJobs",
Params: map[string]interface{}{
Params: map[string]any{
"printerName": "printer1",
},
}
@@ -267,7 +267,7 @@ func TestHandleRequest_UnknownMethod(t *testing.T) {
HandleRequest(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)

View File

@@ -62,7 +62,7 @@ func (sm *SubscriptionManager) createSubscription() (int, error) {
req.OperationAttributes[ipp.AttributeRequestingUserName] = "dms"
// Subscription attributes go in SubscriptionAttributes (subscription-attributes-tag in IPP)
req.SubscriptionAttributes = map[string]interface{}{
req.SubscriptionAttributes = map[string]any{
"notify-events": []string{
"printer-state-changed",
"printer-added",

View File

@@ -83,7 +83,7 @@ func (sm *DBusSubscriptionManager) createDBusSubscription() (int, error) {
req.OperationAttributes[ipp.AttributePrinterURI] = fmt.Sprintf("%s/", sm.baseURL)
req.OperationAttributes[ipp.AttributeRequestingUserName] = "dms"
req.SubscriptionAttributes = map[string]interface{}{
req.SubscriptionAttributes = map[string]any{
"notify-events": []string{
"printer-state-changed",
"printer-added",