Skip to content

Commit b3dab35

Browse files
authored
Mention in docs that template function arguments are reordered
Per #1012 .
1 parent 9a34ff5 commit b3dab35

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/v3.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ This command will return two results:
126126

127127
`mockery migrate` is not comprehensive and likely has missing edge cases. We encourage you to submit issues and PRs for any problems you encounter.
128128

129+
## Config Templates
130+
131+
Template functions used in configuration files have changed. The order of arugments for functions that take input strings is swapped. For example, in v2 the [`trimSuffix` function](https://github.com/vektra/mockery/blob/v2.53.3/pkg/outputter.go#L49) was set to the `strings.TrimSuffix` function from the stdlib. In v3, the argument orders are swapped, for example:
132+
133+
```go
134+
"trimSuffix": func(suffix string, s string) string { return strings.TrimSuffix(s, suffix) },
135+
```
136+
137+
This is done to support [template pipelines](https://pkg.go.dev/text/template#hdr-Pipelines). You can see all of the reordered functions at [pkg.go.dev](https://pkg.go.dev/github.com/vektra/mockery/[email protected]/template_funcs#pkg-variables).
138+
129139
## Layouts
130140

131141
In v2, mockery defaulted to placing mocks in a separate `mocks/` directory as [shown here](https://vektra.github.io/mockery/latest-v2/configuration/#layouts). In v3, mockery will by default place mocks adjacent to the mocked interface.

0 commit comments

Comments
 (0)