Skip to content

Commit 22889d3

Browse files
authored
Merge pull request #1784 from mmorel-35/revive/use-any
chore: enable use-any from revive
2 parents 9438504 + 27ea38b commit 22889d3

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ linters-settings:
9696
- name: unused-parameter
9797
disabled: true
9898
- name: use-any
99-
disabled: true
10099
- name: var-declaration
101100
- name: var-naming
102101
disabled: true

internal/common/binary.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (bigEndian) GoString() string { return "binary.BigEndian" }
137137
// blank (_) field names is skipped; i.e., blank field names
138138
// may be used for padding.
139139
// When reading into a struct, all non-blank fields must be exported.
140-
func Read(r io.Reader, order ByteOrder, data interface{}) error {
140+
func Read(r io.Reader, order ByteOrder, data any) error {
141141
// Fast path for basic types and slices.
142142
if n := intDataSize(data); n != 0 {
143143
var b [8]byte
@@ -229,7 +229,7 @@ func Read(r io.Reader, order ByteOrder, data interface{}) error {
229229
// and read from successive fields of the data.
230230
// When writing structs, zero values are written for fields
231231
// with blank (_) field names.
232-
func Write(w io.Writer, order ByteOrder, data interface{}) error {
232+
func Write(w io.Writer, order ByteOrder, data any) error {
233233
// Fast path for basic types and slices.
234234
if n := intDataSize(data); n != 0 {
235235
var b [8]byte
@@ -339,7 +339,7 @@ func Write(w io.Writer, order ByteOrder, data interface{}) error {
339339
// Size returns how many bytes Write would generate to encode the value v, which
340340
// must be a fixed-size value or a slice of fixed-size values, or a pointer to such data.
341341
// If v is neither of these, Size returns -1.
342-
func Size(v interface{}) int {
342+
func Size(v any) int {
343343
return dataSize(reflect.Indirect(reflect.ValueOf(v)))
344344
}
345345

@@ -607,7 +607,7 @@ func (e *encoder) skip(v reflect.Value) {
607607

608608
// intDataSize returns the size of the data required to represent the data when encoded.
609609
// It returns zero if the type cannot be implemented by the fast path in Read or Write.
610-
func intDataSize(data interface{}) int {
610+
func intDataSize(data any) int {
611611
switch data := data.(type) {
612612
case int8, *int8, *uint8:
613613
return 1

internal/common/common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func IntContains(target []int, src int) bool {
311311

312312
// get struct attributes.
313313
// This method is used only for debugging platform dependent code.
314-
func attributes(m interface{}) map[string]reflect.Type {
314+
func attributes(m any) map[string]reflect.Type {
315315
typ := reflect.TypeOf(m)
316316
if typ.Kind() == reflect.Ptr {
317317
typ = typ.Elem()

0 commit comments

Comments
 (0)