diff --git a/lib/common/variadic/uint32OrHash.go b/lib/common/variadic/uint32OrHash.go index 6bf597505c..4a4c7a4025 100644 --- a/lib/common/variadic/uint32OrHash.go +++ b/lib/common/variadic/uint32OrHash.go @@ -23,6 +23,10 @@ func NewUint32OrHash(value interface{}) (*Uint32OrHash, error) { return &Uint32OrHash{ value: uint32(v), }, nil + case uint: + return &Uint32OrHash{ + value: uint32(v), + }, nil case uint32: return &Uint32OrHash{ value: v, @@ -98,6 +102,7 @@ func (x *Uint32OrHash) IsUint32() bool { if x == nil { return false } + _, is := x.value.(uint32) return is } diff --git a/lib/common/variadic/uint32OrHash_test.go b/lib/common/variadic/uint32OrHash_test.go index 65f27880a9..f5a77d4916 100644 --- a/lib/common/variadic/uint32OrHash_test.go +++ b/lib/common/variadic/uint32OrHash_test.go @@ -25,6 +25,10 @@ func TestNewUint32OrHash(t *testing.T) { require.NoError(t, err) require.Equal(t, uint32(num), res.Value()) + res, err = NewUint32OrHash(uint(num)) + require.NoError(t, err) + require.Equal(t, uint32(num), res.Value()) + res, err = NewUint32OrHash(uint32(num)) require.NoError(t, err) require.Equal(t, uint32(num), res.Value())