Skip to content

Commit

Permalink
Merge pull request #11 from gurukami/dev
Browse files Browse the repository at this point in the history
ineffassign & golint
  • Loading branch information
Nerufa authored May 8, 2019
2 parents ca66c89 + 5ac7ac3 commit 7d793fa
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 45 deletions.
6 changes: 4 additions & 2 deletions int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func init() {
matrixSuite.SetConverters(intReflectTypes, boolReflectTypes, intBoolConverter)
// - to complex
intComplexConverter := func(from interface{}, to reflect.Type, opts ...interface{}) (interface{}, bool) {
rv, c, s := reflect.ValueOf(from), complex128(0), false
var s bool
rv, c := reflect.ValueOf(from), complex128(0)
i := rv.Int()
if s = isSafeIntToFloat(i, bitSizeMap[to.Kind()]); s {
c = complex(float64(i), 0)
Expand All @@ -73,7 +74,8 @@ func init() {
matrixSuite.SetConverters(intReflectTypes, complexReflectTypes, intComplexConverter)
// - to float
intFloatConverter := func(from interface{}, to reflect.Type, opts ...interface{}) (interface{}, bool) {
rv, f, s := reflect.ValueOf(from), float64(0), false
var s bool
rv, f := reflect.ValueOf(from), float64(0)
i := rv.Int()
if s = isSafeIntToFloat(i, bitSizeMap[to.Kind()]); s {
f = float64(i)
Expand Down
4 changes: 2 additions & 2 deletions null_bool.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func (n BoolCommon) Err() error {
return n.Error
}

// BoolAccessor
// BoolAccessor accessor of bool type.
type BoolAccessor interface {
NullCommon
Common
V() bool
Set(value bool)
Clone() BoolAccessor
Expand Down
4 changes: 2 additions & 2 deletions null_common.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package typ

// NullCommon
type NullCommon interface {
// Common general interface of accessor
type Common interface {
Present() bool
Valid() bool
Typ(options ...Option) *Type
Expand Down
8 changes: 4 additions & 4 deletions null_complex.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ func (n ComplexCommon) Err() error {
return n.Error
}

// ComplexAccessor
// ComplexAccessor accessor of complex128 type.
type ComplexAccessor interface {
NullCommon
Common
V() complex128
Set(value complex128)
Clone() ComplexAccessor
Expand Down Expand Up @@ -272,9 +272,9 @@ func (n Complex64Common) Err() error {
return n.Error
}

// Complex64Accessor
// Complex64Accessor accessor of complex64 type.
type Complex64Accessor interface {
NullCommon
Common
V() complex64
Set(value complex64)
Clone() Complex64Accessor
Expand Down
10 changes: 5 additions & 5 deletions null_float.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
)

// Float32 represents a float32 that may be null.
// Float32Common represents a float32 that may be null.
type Float32Common struct {
P *float32
Error error
Expand Down Expand Up @@ -99,9 +99,9 @@ func (n Float32Common) Err() error {
return n.Error
}

// Float32Accessor
// Float32Accessor accessor of float32 type.
type Float32Accessor interface {
NullCommon
Common
V() float32
Set(value float32)
Clone() Float32Accessor
Expand Down Expand Up @@ -264,9 +264,9 @@ func (n FloatCommon) Err() error {
return n.Error
}

// FloatAccessor
// FloatAccessor accessor of float64 type.
type FloatAccessor interface {
NullCommon
Common
V() float64
Set(value float64)
Clone() FloatAccessor
Expand Down
22 changes: 11 additions & 11 deletions null_int.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ func (n IntCommon) Err() error {
return n.Error
}

// IntAccessor
// IntAccessor accessor of int type.
type IntAccessor interface {
NullCommon
Common
V() int
Set(value int)
Clone() IntAccessor
Expand Down Expand Up @@ -274,9 +274,9 @@ func (n Int8Common) Err() error {
return n.Error
}

// Int8Accessor
// Int8Accessor accessor of int8 type.
type Int8Accessor interface {
NullCommon
Common
V() int8
Set(value int8)
Clone() Int8Accessor
Expand Down Expand Up @@ -318,7 +318,7 @@ func NInt8(value int8) Int8Accessor {
return &NullInt8{Int8Common{P: &value}}
}

// NotNullInt represents an int8 with accessor.
// NotNullInt8 represents an int8 with accessor.
type NotNullInt8 struct {
Int8Common
}
Expand Down Expand Up @@ -445,9 +445,9 @@ func (n Int16Common) Err() error {
return n.Error
}

// Int16Accessor
// Int16Accessor accessor of int16 type.
type Int16Accessor interface {
NullCommon
Common
V() int16
Set(value int16)
Clone() Int16Accessor
Expand Down Expand Up @@ -616,9 +616,9 @@ func (n Int32Common) Err() error {
return n.Error
}

// Int32Accessor
// Int32Accessor accessor of int32 type.
type Int32Accessor interface {
NullCommon
Common
V() int32
Set(value int32)
Clone() Int32Accessor
Expand Down Expand Up @@ -790,9 +790,9 @@ func (n Int64Common) Err() error {
return n.Error
}

// Int64Accessor
// Int64Accessor accessor of int64 type.
type Int64Accessor interface {
NullCommon
Common
V() int64
Set(value int64)
Clone() Int64Accessor
Expand Down
4 changes: 2 additions & 2 deletions null_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func (n InterfaceCommon) Err() error {
return n.Error
}

// InterfaceAccessor
// InterfaceAccessor accessor of interface{} type.
type InterfaceAccessor interface {
NullCommon
Common
V() interface{}
Set(value interface{})
Clone() InterfaceAccessor
Expand Down
4 changes: 2 additions & 2 deletions null_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ func (n StringCommon) Err() error {
return n.Error
}

// StringAccessor
// StringAccessor accessor of string type.
type StringAccessor interface {
NullCommon
Common
V() string
Set(value string)
Clone() StringAccessor
Expand Down
4 changes: 2 additions & 2 deletions null_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func (n TimeCommon) Err() error {
return n.Error
}

// TimeAccessor
// TimeAccessor accessor of time.Time type.
type TimeAccessor interface {
NullCommon
Common
V() time.Time
Set(value time.Time)
Clone() TimeAccessor
Expand Down
22 changes: 11 additions & 11 deletions null_uint.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ func (n UintCommon) Err() error {
return n.Error
}

// UintAccessor
// UintAccessor accessor of uint type.
type UintAccessor interface {
NullCommon
Common
V() uint
Set(value uint)
Clone() UintAccessor
Expand Down Expand Up @@ -275,9 +275,9 @@ func (n Uint8Common) Err() error {
return n.Error
}

// Uint8Accessor
// Uint8Accessor accessor of uint8 type.
type Uint8Accessor interface {
NullCommon
Common
V() uint8
Set(value uint8)
Clone() Uint8Accessor
Expand Down Expand Up @@ -319,7 +319,7 @@ func NUint8(value uint8) Uint8Accessor {
return &NullUint8{Uint8Common{P: &value}}
}

// NotNullUint represents an uint8 with accessor.
// NotNullUint8 represents an uint8 with accessor.
type NotNullUint8 struct {
Uint8Common
}
Expand Down Expand Up @@ -446,9 +446,9 @@ func (n Uint16Common) Err() error {
return n.Error
}

// Uint16Accessor
// Uint16Accessor accessor of uint16 type.
type Uint16Accessor interface {
NullCommon
Common
V() uint16
Set(value uint16)
Clone() Uint16Accessor
Expand Down Expand Up @@ -617,9 +617,9 @@ func (n Uint32Common) Err() error {
return n.Error
}

// Uint32Accessor
// Uint32Accessor accessor of uint32 type.
type Uint32Accessor interface {
NullCommon
Common
V() uint32
Set(value uint32)
Clone() Uint32Accessor
Expand Down Expand Up @@ -792,9 +792,9 @@ func (n Uint64Common) Err() error {
return n.Error
}

// Uint64Accessor
// Uint64Accessor accessor of uint64 type.
type Uint64Accessor interface {
NullCommon
Common
V() uint64
Set(value uint64)
Clone() Uint64Accessor
Expand Down
6 changes: 4 additions & 2 deletions uint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func init() {
matrixSuite.SetConverters(uintReflectTypes, boolReflectTypes, uintBoolConverter)
// - to complex
uintComplexConverter := func(from interface{}, to reflect.Type, opts ...interface{}) (interface{}, bool) {
rv, c, s := reflect.ValueOf(from), complex128(0), false
var s bool
rv, c := reflect.ValueOf(from), complex128(0)
i := rv.Uint()
if s = isSafeUintToFloat(i, bitSizeMap[to.Kind()]); s {
c = complex(float64(i), 0)
Expand All @@ -65,7 +66,8 @@ func init() {
matrixSuite.SetConverters(uintReflectTypes, complexReflectTypes, uintComplexConverter)
// - to float
uintFloatConverter := func(from interface{}, to reflect.Type, opts ...interface{}) (interface{}, bool) {
rv, f, s := reflect.ValueOf(from), float64(0), false
var s bool
rv, f := reflect.ValueOf(from), float64(0)
i := rv.Uint()
if s = isSafeUintToFloat(i, bitSizeMap[to.Kind()]); s {
f = float64(i)
Expand Down

0 comments on commit 7d793fa

Please sign in to comment.