Skip to content

Commit

Permalink
change import paths to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
LandonTClipp committed Jan 1, 2025
1 parent 1a26a55 commit 299d98f
Show file tree
Hide file tree
Showing 98 changed files with 157 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ builds:
- main: ./main.go
binary: mockery
ldflags:
- -s -w -X github.com/vektra/mockery/v2/pkg/logging.SemVer=v{{.Version}}
- -s -w -X github.com/vektra/mockery/v3/pkg/logging.SemVer=v{{.Version}}
env:
- CGO_ENABLED=0
goos:
Expand Down
24 changes: 12 additions & 12 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ _anchors: &inpackage_config
pkgname: "{{.SrcPackageName}}_test"
filename: "mock_{{.InterfaceName | snakecase }}_test.go"
packages:
github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment:
github.com/vektra/mockery/v3/pkg/fixtures/buildtag/comment:
config:
mock-build-tags: "custom3 && (!windows || !darwin || !freebsd)"
interfaces:
IfaceWithCustomBuildTagInComment:
github.com/vektra/mockery/v2/pkg:
github.com/vektra/mockery/v3/pkg:
interfaces:
TypesPackage:
github.com/vektra/mockery/v2/pkg/fixtures:
github.com/vektra/mockery/v3/pkg/fixtures:
config:
all: True
interfaces:
Expand All @@ -45,45 +45,45 @@ packages:
config:
template-data:
unroll-variadic: False
github.com/vektra/mockery/v2/pkg/fixtures/recursive_generation:
github.com/vektra/mockery/v3/pkg/fixtures/recursive_generation:
config:
recursive: True
all: True
dir: "{{.InterfaceDir}}"
filename: "{{.InterfaceName}}_mock.go"
mockname: "Mock{{.InterfaceName}}"
pkgname: "{{.SrcPackageName}}"
github.com/vektra/mockery/v2/pkg/fixtures/empty_return:
github.com/vektra/mockery/v3/pkg/fixtures/empty_return:
config:
all: True
dir: "{{.InterfaceDir}}"
mockname: "{{.InterfaceName}}Mock"
pkgname: "{{.SrcPackageName}}"
filename: "mock_{{.InterfaceName}}_test.go"
github.com/vektra/mockery/v2/pkg/fixtures/method_args/same_name_arg_and_type:
github.com/vektra/mockery/v3/pkg/fixtures/method_args/same_name_arg_and_type:
config:
all: True
dir: "{{.InterfaceDir}}"
mockname: "{{.InterfaceName}}Mock"
pkgname: "{{.SrcPackageName}}"
filename: "mock_{{.InterfaceName}}_test.go"
github.com/vektra/mockery/v2/pkg/fixtures/iface_typed_param:
github.com/vektra/mockery/v3/pkg/fixtures/iface_typed_param:
config: *inpackage_config
github.com/vektra/mockery/v2/pkg/fixtures/example_project:
github.com/vektra/mockery/v3/pkg/fixtures/example_project:
config: *inpackage_config
github.com/vektra/mockery/v2/pkg/fixtures/index_list_expr:
github.com/vektra/mockery/v3/pkg/fixtures/index_list_expr:
config: *inpackage_config
github.com/vektra/mockery/v2/pkg/fixtures/iface_new_type:
github.com/vektra/mockery/v3/pkg/fixtures/iface_new_type:
config: *inpackage_config
github.com/vektra/mockery/v2/pkg/fixtures/issue845:
github.com/vektra/mockery/v3/pkg/fixtures/issue845:
config:
<<: *inpackage_config
filename: "mock_{{.MockName}}_test.go"
interfaces:
Interface:
configs:
- mockname: WithFix
github.com/vektra/mockery/v2/pkg/fixtures/type_alias:
github.com/vektra/mockery/v3/pkg/fixtures/type_alias:
config:
all: True
dir: "{{.InterfaceDir}}"
Expand Down
2 changes: 1 addition & 1 deletion .mockery_moq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dir: "mocks/moq/{{.SrcPackagePath}}"
formatter: "goimports"

packages:
github.com/vektra/mockery/v2/pkg/fixtures:
github.com/vektra/mockery/v3/pkg/fixtures:
config:
include-regex: '.*'
exclude-regex: 'RequesterGenerics|UnsafeInterface|requester_unexported'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

mockery
=======
[![Release](https://github.com/vektra/mockery/actions/workflows/release.yml/badge.svg)](https://github.com/vektra/mockery/actions/workflows/release.yml) [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vektra/mockery/v2?tab=overview) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/vektra/mockery) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/vektra/mockery) [![Go Report Card](https://goreportcard.com/badge/github.com/vektra/mockery)](https://goreportcard.com/report/github.com/vektra/mockery) [![codecov](https://codecov.io/gh/vektra/mockery/branch/master/graph/badge.svg)](https://codecov.io/gh/vektra/mockery)
[![Release](https://github.com/vektra/mockery/actions/workflows/release.yml/badge.svg)](https://github.com/vektra/mockery/actions/workflows/release.yml) [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vektra/mockery/v3?tab=overview) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/vektra/mockery) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/vektra/mockery) [![Go Report Card](https://goreportcard.com/badge/github.com/vektra/mockery)](https://goreportcard.com/report/github.com/vektra/mockery) [![codecov](https://codecov.io/gh/vektra/mockery/branch/master/graph/badge.svg)](https://codecov.io/gh/vektra/mockery)

mockery provides the ability to easily generate mocks for Golang interfaces using the [stretchr/testify/mock](https://pkg.go.dev/github.com/stretchr/testify/mock?tab=doc) package. It removes the boilerplate coding required to use mocks.

Expand Down
6 changes: 3 additions & 3 deletions cmd/mockery.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/vektra/mockery/v2/pkg"
"github.com/vektra/mockery/v2/pkg/logging"
"github.com/vektra/mockery/v2/pkg/stackerr"
"github.com/vektra/mockery/v3/pkg"
"github.com/vektra/mockery/v3/pkg/logging"
"github.com/vektra/mockery/v3/pkg/stackerr"
"golang.org/x/tools/go/packages"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/showconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/vektra/mockery/v2/pkg"
"github.com/vektra/mockery/v2/pkg/logging"
"github.com/vektra/mockery/v2/pkg/stackerr"
"github.com/vektra/mockery/v3/pkg"
"github.com/vektra/mockery/v3/pkg/logging"
"github.com/vektra/mockery/v3/pkg/stackerr"
"gopkg.in/yaml.v3"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/showconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestShowCfg(t *testing.T) {
with-expecter: true
all: true
packages:
github.com/vektra/mockery/v2/pkg:
github.com/vektra/mockery/v3/pkg:
config:
all: true`))
assert.NoError(t, err)
Expand All @@ -31,7 +31,7 @@ packages:
assert.NoError(t, showConfig(nil, nil, v, buf))
assert.Equal(t, `all: true
packages:
github.com/vektra/mockery/v2/pkg:
github.com/vektra/mockery/v3/pkg:
config:
all: true
with-expecter: true
Expand Down
14 changes: 7 additions & 7 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ The format of the parameter is:
For example:

```shell
mockery --replace-type github.com/vektra/mockery/v2/baz/internal/foo.InternalBaz=baz:github.com/vektra/mockery/v2/baz.Baz
mockery --replace-type github.com/vektra/mockery/v3/baz/internal/foo.InternalBaz=baz:github.com/vektra/mockery/v3/baz.Baz
```

This will replace any imported named `"github.com/vektra/mockery/v2/baz/internal/foo"`
with `baz "github.com/vektra/mockery/v2/baz"`. The alias is defined with `:` before
This will replace any imported named `"github.com/vektra/mockery/v3/baz/internal/foo"`
with `baz "github.com/vektra/mockery/v3/baz"`. The alias is defined with `:` before
the package name. Also, the `InternalBaz` type that comes from this package will be renamed to `baz.Baz`.

This next example fixes a common problem of type aliases that point to an internal package.
Expand Down Expand Up @@ -93,7 +93,7 @@ func (_m *Handler) HandleMessage(m pubsub.Message) error {
Generic type constraints can also be replaced by targeting the changed parameter with the square bracket notation on the left-hand side.

```shell
mockery --replace-type github.com/vektra/mockery/v2/baz/internal/foo.InternalBaz[T]=github.com/vektra/mockery/v2/baz.Baz
mockery --replace-type github.com/vektra/mockery/v3/baz/internal/foo.InternalBaz[T]=github.com/vektra/mockery/v3/baz.Baz
```

For example:
Expand All @@ -112,7 +112,7 @@ func (*InternalBaz[T]) Foo() T {}
If a type constraint needs to be removed and replaced with a type, target the constraint with square brackets and include a '-' in front to have it removed.

```shell
mockery --replace-type github.com/vektra/mockery/v2/baz/internal/foo.InternalBaz[-T]=github.com/vektra/mockery/v2/baz.Baz
mockery --replace-type github.com/vektra/mockery/v3/baz/internal/foo.InternalBaz[-T]=github.com/vektra/mockery/v3/baz.Baz
```

For example:
Expand All @@ -131,7 +131,7 @@ func (*InternalBaz) Foo() baz.Baz {}
When replacing a generic constraint, you can replace the type with a pointer by adding a '*' before the output type name.

```shell
mockery --replace-type github.com/vektra/mockery/v2/baz/internal/foo.InternalBaz[-T]=github.com/vektra/mockery/v2/baz.*Baz
mockery --replace-type github.com/vektra/mockery/v3/baz/internal/foo.InternalBaz[-T]=github.com/vektra/mockery/v3/baz.*Baz
```

For example:
Expand Down Expand Up @@ -170,7 +170,7 @@ Here is an example configuration set:
```yaml
with-expecter: True
packages:
github.com/vektra/mockery/v2/pkg: # (1)!
github.com/vektra/mockery/v3/pkg: # (1)!
interfaces:
TypesPackage:
RequesterVariadic:
Expand Down
2 changes: 1 addition & 1 deletion docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mockname: "{{.InterfaceName}}"
filename: "{{.MockName}}.go"
outpkg: mocks
packages:
github.com/vektra/mockery/v2/pkg:
github.com/vektra/mockery/v3/pkg:
interfaces:
TypesPackage:
# Lots more config...
Expand Down
6 changes: 0 additions & 6 deletions e2e/.mockery-disable-func-mock.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions e2e/test_disable_func_mocks.sh

This file was deleted.

5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
module github.com/vektra/mockery/v2
module github.com/vektra/mockery/v3

go 1.23

toolchain go1.23.1

require (
github.com/chigopher/pathlib v0.19.1
github.com/davecgh/go-spew v1.1.1
github.com/huandu/xstrings v1.4.0
github.com/iancoleman/strcase v0.2.0
github.com/jinzhu/copier v0.3.5
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.5.0
Expand All @@ -22,6 +20,7 @@ require (
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/frankban/quicktest v1.14.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/vektra/mockery/v2/cmd"
"github.com/vektra/mockery/v3/cmd"
)

func main() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 299d98f

Please sign in to comment.