Skip to content

Commit

Permalink
Replace empty slice literal with var (#128)
Browse files Browse the repository at this point in the history
* Replace empty slice literal with `var`

* Initialize map with make() function

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Schweder <jonathanschweder@amazon.com>
  • Loading branch information
deepsource-autofix[bot] and Jonathan Schweder committed Dec 25, 2022
1 parent cfcb392 commit 498a0ce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions faker.go
Expand Up @@ -229,7 +229,8 @@ func (f Faker) RandomLetter() string {
}

func (f Faker) RandomStringWithLength(l int) string {
r := []string{}
var r []string

for i := 0; i < l; i++ {
r = append(r, f.RandomLetter())
}
Expand Down Expand Up @@ -344,7 +345,8 @@ func (f Faker) Boolean() Boolean {

// Map returns a fake Map instance for Faker
func (f Faker) Map() map[string]interface{} {
m := map[string]interface{}{}
m := make(map[string]interface{})

lorem := f.Lorem()

randWordType := func() string {
Expand Down Expand Up @@ -382,7 +384,8 @@ func (f Faker) Map() map[string]interface{} {
case "slice":
m[lorem.Word()] = randSlice()
case "map":
mm := map[string]interface{}{}
mm := make(map[string]interface{})

tt := f.RandomStringElement([]string{"string", "int", "float", "slice"})
switch tt {
case "string":
Expand Down

0 comments on commit 498a0ce

Please sign in to comment.