Skip to content

Commit

Permalink
mention the uber fork instead of archived golang/mock (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Aug 29, 2023
1 parent 300a318 commit 7f084c1
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# gomockhandler

**If you find any bugs or have feature requests, please feel free to create an issue.**

Mr. gomockhandler is the clever and fast manager of mocks generated by [golang/mock](https://github.com/golang/mock).
Mr. gomockhandler is the clever and fast manager of mocks generated by [uber-go/mock](https://github.com/uber-go/mock) (or [golang/mock](https://github.com/golang/mock)).

<img src="https://user-images.githubusercontent.com/44139130/131862740-6b4bfba8-be02-43d0-99d1-62efd8318381.JPG" width="400px">

Expand Down Expand Up @@ -34,15 +32,8 @@ And with this background, it is designed to make it easy to switch from managing

You have to install `mockgen` first.

### Go version < 1.16
```
GO111MODULE=on go get github.com/golang/mock/mockgen
GO111MODULE=on go get github.com/sanposhiho/gomockhandler
```
### Go 1.16+
```
go install github.com/golang/mock/mockgen@latest
go install github.com/sanposhiho/gomockhandler@latest
go install go.uber.org/mock/mockgen@latest
```

## How to use
Expand Down Expand Up @@ -78,13 +69,12 @@ However, you don't need to generate/edit the config directly, it can be generate

### configuring a new mock

You can configure a new mock to be generated with CLI. It will also check if mockgen will run correctly with that option.
You can configure a new mock to be generated with `gomockhandler` CLI.

If a config file does not exist, a config file will be created.
If a gomockhandler config file does not exist, it will be created.

`mockgen` has two modes of operation: source and reflect, and gomockhandler support both.

See [golang/mock#running-mockgen](https://github.com/golang/mock#running-mockgen) for more information about the two modes and mockgen options.
gomockhandler CLI is compatible with `mockgen` command which you can do anything you do with `mockgen`
See [golang/mock#running-mockgen](https://github.com/uber-go/mock#running-mockgen) for more information about the two modes and mockgen options.

Source mode:
```
Expand All @@ -98,9 +88,7 @@ gomockhandler -config=/path/to/gomockhandler.json -destination=./mock/ [other mo

---

You can use all options of mockgen to add a new mock.

For example, suppose you want to configure the mock generated by the following mockgen command to be generated by gomockhandler
For example, suppose you want to configure the mock generated by the following `mockgen` command to be generated by `gomockhandler`

```
mockgen -source=foo.go -destination=../mock/
Expand All @@ -113,7 +101,6 @@ As you can see, you just need to think about the option `config`. (The default v
gomockhandler -config=/path/to/gomockhandler.json -source=foo.go -destination=../mock/
```


### [TIPS] switch from `go generate` to gomockhandler

gomockhandler is designed to make it easy to switch from managing mocks with `go generate` to managing mocks with gomockhandler.
Expand Down

0 comments on commit 7f084c1

Please sign in to comment.