Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Sep 9, 2024
1 parent b6717c6 commit 8bd4b9b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions hash/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type visitOpts struct {

var timeType = reflect.TypeOf(time.Time{})

// nolint:gocyclo
func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) {
t := reflect.TypeOf(0)

Expand Down Expand Up @@ -154,11 +155,12 @@ func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) {

// Binary writing can use raw ints, we have to convert to
// a sized-int, we'll choose the largest...
// nolint:exhaustive
switch v.Kind() {
case reflect.Int:
v = reflect.ValueOf(int64(v.Int()))
v = reflect.ValueOf(v.Int())
case reflect.Uint:
v = reflect.ValueOf(uint64(v.Uint()))
v = reflect.ValueOf(v.Uint())
case reflect.Bool:
var tmp int8
if v.Bool() {
Expand All @@ -177,8 +179,7 @@ func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) {
return w.h.Sum64(), err
}

switch v.Type() {
case timeType:
if v.Type() == timeType {
w.h.Reset()
b, err := v.Interface().(time.Time).MarshalBinary()
if err != nil {
Expand All @@ -189,6 +190,7 @@ func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) {
return w.h.Sum64(), err
}

// nolint:exhaustive
switch k {
case reflect.Array:
var h uint64
Expand Down Expand Up @@ -323,8 +325,7 @@ func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) {
}
}

switch tag {
case "set":
if tag == "set" {
f |= visitFlagSet
}

Expand Down

0 comments on commit 8bd4b9b

Please sign in to comment.