summaryrefslogtreecommitdiff
path: root/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-07-24 14:35:44 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-07-24 14:35:44 +0200
commit621e49bb465f500cc46d47e39e828cf76d6381d7 (patch)
treee9d6ed54cfae73209f2b0d9a016ef0b64adf45a6 /vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md
parent5b9a4a158b81aa6e94a5a56d0851bea938b87bef (diff)
update vendor
Diffstat (limited to 'vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md')
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md b/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md
new file mode 100644
index 0000000..ffb5f9f
--- /dev/null
+++ b/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md
@@ -0,0 +1,26 @@
+The generated mock methods use some hardcoded variable/receiver names that can
+have conflicts with the argument names that are defined by the code for which
+the mock is generated when using the source generation method.
+
+Example:
+
+```go
+type Example interface {
+ Method(_m, _mr, m, mr int)
+}
+```
+
+```go
+// Method mocks base method
+func (_m *MockExample) Method(_m int, _mr int, m int, mr int) {
+ _m.ctrl.Call(_m, "Method", _m, _mr, m, mr)
+}
+```
+
+In the above example one of the interface method parameters is called `_m`
+but unfortunately the generated receiver name is also called `_m` so the
+mock code won't compile.
+
+The generator has to make sure that generated identifiers (e.g.: the receiver
+names) are always different from the arg names that might come from external
+sources.