diff --git a/client/client.go b/client/client.go index 619f62b..db99274 100644 --- a/client/client.go +++ b/client/client.go @@ -129,15 +129,15 @@ func (c *Client) SetVoteChoices(ctx context.Context, req types.SetVoteChoicesReq return resp, nil } -func (c *Client) post(ctx context.Context, path string, addr stdaddr.Address, resp, req interface{}) error { +func (c *Client) post(ctx context.Context, path string, addr stdaddr.Address, resp, req any) error { return c.do(ctx, http.MethodPost, path, addr, resp, req) } -func (c *Client) get(ctx context.Context, path string, resp interface{}) error { +func (c *Client) get(ctx context.Context, path string, resp any) error { return c.do(ctx, http.MethodGet, path, nil, resp, nil) } -func (c *Client) do(ctx context.Context, method, path string, addr stdaddr.Address, resp, req interface{}) error { +func (c *Client) do(ctx context.Context, method, path string, addr stdaddr.Address, resp, req any) error { var reqBody io.Reader var sig []byte diff --git a/client/client_test.go b/client/client_test.go index 0fc4f82..da87517 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -86,7 +86,7 @@ func TestErrorDetails(t *testing.T) { Log: slog.Disabled, } - var resp interface{} + var resp any err := client.do(context.TODO(), http.MethodGet, "", nil, &resp, nil) testServer.Close() @@ -171,7 +171,7 @@ func TestSignatureValidation(t *testing.T) { Log: slog.Disabled, } - var resp interface{} + var resp any err := client.do(context.TODO(), http.MethodGet, "", nil, &resp, nil) testServer.Close() diff --git a/rpc/client.go b/rpc/client.go index 3b1341b..58422ab 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -24,7 +24,7 @@ type Caller interface { // Args provides positional parameters for the call. // Res must be a pointer to a struct, slice, or map type to unmarshal // a result (if any), or nil if no result is needed. - Call(ctx context.Context, method string, res interface{}, args ...interface{}) error + Call(ctx context.Context, method string, res any, args ...any) error } // client wraps a wsrpc.Client, as well as all of the connection details diff --git a/webapi/admin.go b/webapi/admin.go index ab9b2a8..fa8aff6 100644 --- a/webapi/admin.go +++ b/webapi/admin.go @@ -263,7 +263,7 @@ func (s *Server) downloadDatabaseBackup(c *gin.Context) { // setAdminStatus stores the authentication status of the current session and // redirects the client to GET /admin. -func (s *Server) setAdminStatus(admin interface{}, c *gin.Context) { +func (s *Server) setAdminStatus(admin any, c *gin.Context) { session := c.MustGet(sessionKey).(*sessions.Session) session.Values["admin"] = admin err := session.Save(c.Request, c.Writer) diff --git a/webapi/webapi.go b/webapi/webapi.go index 4c86332..e3f30d9 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -283,7 +283,7 @@ func (s *Server) router(cookieSecret []byte, dcrd rpc.DcrdConnect, wallets rpc.W // sendJSONResponse serializes the provided response, signs it, and sends the // response to the client with a 200 OK status. Returns the seralized response // and the signature. -func (s *Server) sendJSONResponse(resp interface{}, c *gin.Context) (string, string) { +func (s *Server) sendJSONResponse(resp any, c *gin.Context) (string, string) { dec, err := json.Marshal(resp) if err != nil { s.log.Errorf("JSON marshal error: %v", err)