Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
RangelReale committed Feb 8, 2023
1 parent 9249785 commit c152fc0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,15 @@ This parameter can be specified multiple times.

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
the package name. Also, the `InternalBaz` type that comes from this package will be renamed to `Baz´.
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.

`cloud.google.com/go/pubsub.Message` is a type alias defined like this:

```go
import (
ipubsub "cloud.google.com/go/internal/pubsub"
ipubsub "cloud.google.com/go/internal/pubsub"
)

type Message = ipubsub.Message
Expand All @@ -435,7 +435,7 @@ Original source:

```go
import (
"cloud.google.com/go/pubsub"
"cloud.google.com/go/pubsub"
)

type Handler struct {
Expand All @@ -447,29 +447,29 @@ Mock generated without this parameter:

```go
import (
mock "github.com/stretchr/testify/mock"
mock "github.com/stretchr/testify/mock"

pubsub "cloud.google.com/go/internal/pubsub"
pubsub "cloud.google.com/go/internal/pubsub"
)

func (_m *Handler) HandleMessage(m pubsub.Message) error {
// ...
return nil
// ...
return nil
}
```

Mock generated with this parameter.

```go
import (
mock "github.com/stretchr/testify/mock"
mock "github.com/stretchr/testify/mock"

pubsub "cloud.google.com/go/pubsub"
pubsub "cloud.google.com/go/pubsub"
)

func (_m *Handler) HandleMessage(m pubsub.Message) error {
// ...
return nil
// ...
return nil
}
```

Expand Down

0 comments on commit c152fc0

Please sign in to comment.