Skip to content

Commit

Permalink
unused - remove unused function variables
Browse files Browse the repository at this point in the history
  • Loading branch information
brianvoe committed Feb 27, 2024
1 parent 51c0cc0 commit aff3693
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func addFileJSONLookup() {
// encoding/json.RawMessage is a special case of []byte
// it cannot be handled as a reflect.Array/reflect.Slice
// because it needs additional structure in the output
func rJsonRawMessage(f *Faker, t reflect.Type, v reflect.Value, tag string, size int) error {
func rJsonRawMessage(f *Faker, v reflect.Value) error {
b, err := f.JSON(nil)
if err != nil {
return err
Expand All @@ -268,7 +268,7 @@ func rJsonRawMessage(f *Faker, t reflect.Type, v reflect.Value, tag string, size
// that represents a JSON number literal.
// It cannot be handled as a string because it needs to
// represent an integer or a floating-point number.
func rJsonNumber(f *Faker, t reflect.Type, v reflect.Value, tag string, size int) error {
func rJsonNumber(f *Faker, v reflect.Value, tag string) error {
var ret json.Number

var numberType string
Expand Down
2 changes: 1 addition & 1 deletion lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (i *Info) GetField(m *MapParams, field string) (*Param, []string, error) {
}

return p, value, nil
} else if m == nil && p.Default != "" {
} else if p.Default != "" {
// If p.Type is []uint, then we need to convert it to []string
if strings.HasPrefix(p.Default, "[") {
// Remove [] from type
Expand Down
12 changes: 6 additions & 6 deletions struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func r(f *Faker, t reflect.Type, v reflect.Value, tag string, size int) error {

switch t.Name() {
case "RawMessage":
return rJsonRawMessage(f, t, v, tag, size)
return rJsonRawMessage(f, v)
case "Number":
return rJsonNumber(f, t, v, tag, size)
return rJsonNumber(f, v, tag)
default:
return errors.New("unknown encoding/json type: " + t.Name())
}
Expand Down Expand Up @@ -72,7 +72,7 @@ func r(f *Faker, t reflect.Type, v reflect.Value, tag string, size int) error {
return nil
}

func rCustom(f *Faker, t reflect.Type, v reflect.Value, tag string) error {
func rCustom(f *Faker, v reflect.Value, tag string) error {
// If tag is empty return error
if tag == "" {
return errors.New("tag is empty")
Expand Down Expand Up @@ -126,7 +126,7 @@ func rCustom(f *Faker, t reflect.Type, v reflect.Value, tag string) error {
func rStruct(f *Faker, t reflect.Type, v reflect.Value, tag string) error {
// Check if tag exists, if so run custom function
if t.Name() != "" && tag != "" {
return rCustom(f, t, v, tag)
return rCustom(f, v, tag)
}

// Check if struct is fakeable
Expand Down Expand Up @@ -252,7 +252,7 @@ func rSlice(f *Faker, t reflect.Type, v reflect.Value, tag string, size int) err
// Check if tag exists, if so run custom function
if t.Name() != "" && tag != "" {
// Check to see if custom function works if not continue to normal loop of values
err := rCustom(f, t, v, tag)
err := rCustom(f, v, tag)
if err == nil {
return nil
}
Expand Down Expand Up @@ -308,7 +308,7 @@ func rMap(f *Faker, t reflect.Type, v reflect.Value, tag string, size int) error

// Check if tag exists, if so run custom function
if tag != "" {
return rCustom(f, t, v, tag)
return rCustom(f, v, tag)
} else if size > 0 {
// NOOP
} else if isFakeable(t) {
Expand Down

0 comments on commit aff3693

Please sign in to comment.