Skip to content

How to use mockgen

Weilong edited this page Dec 28, 2023 · 2 revisions

Prerequisite

Edit .bashrc file before using mockgen

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Install go-mock

go install go.uber.org/mock/mockgen@latest

link: https://github.com/uber-go/mock

Create a mockfile

mockgen -source=path/file.go -destination=path/file.go

Clone this wiki locally