chore: enable use-any rule from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-08-08 16:01:30 +02:00
parent 5cb7e19528
commit 96f8c6395e
162 changed files with 573 additions and 564 deletions

View File

@@ -119,12 +119,12 @@ func WithRequestTimeout(t time.Duration) func(*RequestOpts) {
// Call calls the specified method with the specified arguments for the plugin.
// It will retry for 30 seconds if a failure occurs when calling.
func (c *Client) Call(serviceMethod string, args, ret interface{}) error {
func (c *Client) Call(serviceMethod string, args, ret any) error {
return c.CallWithOptions(serviceMethod, args, ret)
}
// CallWithOptions is just like call except it takes options
func (c *Client) CallWithOptions(serviceMethod string, args interface{}, ret interface{}, opts ...func(*RequestOpts)) error {
func (c *Client) CallWithOptions(serviceMethod string, args any, ret any, opts ...func(*RequestOpts)) error {
var buf bytes.Buffer
if args != nil {
if err := json.NewEncoder(&buf).Encode(args); err != nil {
@@ -146,7 +146,7 @@ func (c *Client) CallWithOptions(serviceMethod string, args interface{}, ret int
}
// Stream calls the specified method with the specified arguments for the plugin and returns the response body
func (c *Client) Stream(serviceMethod string, args interface{}) (io.ReadCloser, error) {
func (c *Client) Stream(serviceMethod string, args any) (io.ReadCloser, error) {
var buf bytes.Buffer
if err := json.NewEncoder(&buf).Encode(args); err != nil {
return nil, err
@@ -155,7 +155,7 @@ func (c *Client) Stream(serviceMethod string, args interface{}) (io.ReadCloser,
}
// SendFile calls the specified method, and passes through the IO stream
func (c *Client) SendFile(serviceMethod string, data io.Reader, ret interface{}) error {
func (c *Client) SendFile(serviceMethod string, data io.Reader, ret any) error {
body, err := c.callWithRetry(serviceMethod, data, true)
if err != nil {
return err

View File

@@ -13,7 +13,7 @@ type wobble struct {
}
// Fooer is an empty interface used for tests.
type Fooer interface{}
type Fooer interface{} //nolint:revive // any Alias is not supported yet
// Fooer2 is an interface used for tests.
type Fooer2 interface {

View File

@@ -16,7 +16,7 @@ var errBadReturn = errors.New("found return arg with no name: all args must be n
type errUnexpectedType struct {
expected string
actual interface{}
actual any
}
func (e errUnexpectedType) Error() string {

View File

@@ -37,7 +37,7 @@ type BufioReaderPool struct {
func newBufioReaderPoolWithSize(size int) *BufioReaderPool {
return &BufioReaderPool{
pool: sync.Pool{
New: func() interface{} { return bufio.NewReaderSize(nil, size) },
New: func() any { return bufio.NewReaderSize(nil, size) },
},
}
}
@@ -62,7 +62,7 @@ type bufferPool struct {
func newBufferPoolWithSize(size int) *bufferPool {
return &bufferPool{
pool: sync.Pool{
New: func() interface{} { s := make([]byte, size); return &s },
New: func() any { s := make([]byte, size); return &s },
},
}
}
@@ -105,7 +105,7 @@ type BufioWriterPool struct {
func newBufioWriterPoolWithSize(size int) *BufioWriterPool {
return &BufioWriterPool{
pool: sync.Pool{
New: func() interface{} { return bufio.NewWriterSize(nil, size) },
New: func() any { return bufio.NewWriterSize(nil, size) },
},
}
}