golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.28k stars 610 forks source link

Support Map in SetArg #588

Closed lovung closed 2 years ago

lovung commented 2 years ago

Requested feature

Why the feature is needed

Example, I want to generate the Mock for AddItem function and use SetArg to set the after value.

https://play.golang.org/p/sXnsc8FExox

package main

import (
    "fmt"
)

func main() {
    var exampleMap = make(map[string]string)
    AddItem(exampleMap, "A", "B")
    fmt.Println(exampleMap)
}

func AddItem(input map[string]string, key, value string) {
    if input == nil {
        return
    }
    input[key] = value
}