Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated text version #745

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Go Test

on:
push:
branches: [ master ]
branches: [ v3 ]
pull_request:
branches: [ master ]
branches: [ v3 ]

jobs:
build:
Expand All @@ -13,6 +13,7 @@ jobs:
matrix:
os: [ macos-latest, ubuntu-latest]
go_vers: [1.19]

steps:
- uses: actions/checkout@v2
with:
Expand Down
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/config.SemVer=v{{.Version}}
- -s -w -X github.com/vektra/mockery/v3/pkg/config.SemVer=v{{.Version}}
env:
- CGO_ENABLED=0
goos:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ test: mocks
go test ./...

mocks: $(shell find . -type f -name '*.go' -not -name '*_test.go')
go run . --dir pkg/fixtures --output mocks/pkg/fixtures
go run . --all=false --print --dir pkg/fixtures --name RequesterVariadic --structname RequesterVariadicOneArgument --unroll-variadic=False > mocks/pkg/fixtures/RequesterVariadicOneArgument.go
go run . --all=false --print --dir pkg/fixtures --name Expecter --with-expecter > mocks/pkg/fixtures/Expecter.go
go run . --dir pkg/fixtures --output mocks/pkg/fixtures --with-expecter=False
go run . --all=false --print --dir pkg/fixtures --name RequesterVariadic --structname RequesterVariadicOneArgument --unroll-variadic=False --with-expecter=False > mocks/pkg/fixtures/RequesterVariadicOneArgument.go
go run . --all=false --print --dir pkg/fixtures --name Expecter > mocks/pkg/fixtures/Expecter.go
@touch mocks

.PHONY: install
Expand Down
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -67,7 +67,7 @@ Supported, but not recommended: [see wiki page](https://github.com/vektra/mocker

Alternatively, you can use the go install method to compile the project using your local environment:

go install github.com/vektra/mockery/v2@latest
go install github.com/vektra/mockery/v3@latest

Configuration
--------------
Expand Down
8 changes: 4 additions & 4 deletions cmd/mockery.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,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/config"
"github.com/vektra/mockery/v2/pkg/logging"
"github.com/vektra/mockery/v3/pkg"
"github.com/vektra/mockery/v3/pkg/config"
"github.com/vektra/mockery/v3/pkg/logging"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/tools/go/packages"
)
Expand Down Expand Up @@ -74,7 +74,7 @@ func NewRootCmd() *cobra.Command {
pFlags.String("boilerplate-file", "", "File to read a boilerplate text from. Text should be a go block comment, i.e. /* ... */")
pFlags.Bool("unroll-variadic", true, "For functions with variadic arguments, do not unroll the arguments into the underlying testify call. Instead, pass variadic slice as-is.")
pFlags.Bool("exported", false, "Generates public mocks for private interfaces.")
pFlags.Bool("with-expecter", false, "Generate expecter utility around mock's On, Run and Return methods with explicit types. This option is NOT compatible with -unroll-variadic=false")
pFlags.Bool("with-expecter", true, "Generate expecter utility around mock's On, Run and Return methods with explicit types. This option is NOT compatible with --unroll-variadic=false")

viper.BindPFlags(pFlags)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mockery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/vektra/mockery/v2/pkg/config"
"github.com/vektra/mockery/v3/pkg/config"
)

func TestNewRootCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/showconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/vektra/mockery/v2/pkg/config"
"github.com/vektra/mockery/v3/pkg/config"
"gopkg.in/yaml.v2"
)

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

go 1.19

Expand Down Expand Up @@ -36,7 +36,7 @@ require (
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
40 changes: 0 additions & 40 deletions hack/run-e2e.sh

This file was deleted.

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
2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/A.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/EmbeddedGet.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/Example.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/GetGeneric.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/HasConflictingNestedImports.go

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

4 changes: 2 additions & 2 deletions mocks/pkg/fixtures/ImportsSameAsPackage.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/KeyManager.go

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

4 changes: 2 additions & 2 deletions mocks/pkg/fixtures/RequesterGenerics.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/UsesOtherPkgIface.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/example_project/Root.go

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

2 changes: 1 addition & 1 deletion mocks/pkg/fixtures/example_project/foo/Foo.go

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.

2 changes: 1 addition & 1 deletion pkg/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
mocks "github.com/vektra/mockery/v2/mocks/pkg/fixtures"
mocks "github.com/vektra/mockery/v3/mocks/pkg/fixtures"
)

// CompatSuite covers compatibility with github.com/stretchr/testify/mock.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package foo

import "github.com/vektra/mockery/v2/pkg/fixtures/example_project/bar/foo"
import "github.com/vektra/mockery/v3/pkg/fixtures/example_project/bar/foo"

type PackageNameSameAsImport interface {
NewClient() foo.Client
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/example_project/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example_project

import "github.com/vektra/mockery/v2/pkg/fixtures/example_project/foo"
import "github.com/vektra/mockery/v3/pkg/fixtures/example_project/foo"

type Root interface {
TakesBaz(*foo.Baz)
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package test
import (
"io"

"github.com/vektra/mockery/v2/pkg/fixtures/constraints"
"github.com/vektra/mockery/v3/pkg/fixtures/constraints"
)

type RequesterGenerics[
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/imports_from_nested_interface.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package test

import (
"github.com/vektra/mockery/v2/pkg/fixtures/http"
"github.com/vektra/mockery/v3/pkg/fixtures/http"
)

type HasConflictingNestedImports interface {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/imports_same_as_package.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package test

import (
"github.com/vektra/mockery/v2/pkg/fixtures/test"
"github.com/vektra/mockery/v3/pkg/fixtures/test"
)

type C int
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/mocks/expecter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
mocks "github.com/vektra/mockery/v2/mocks/pkg/fixtures"
mocks "github.com/vektra/mockery/v3/mocks/pkg/fixtures"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/same_name_imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package test
import (
"net/http"

my_http "github.com/vektra/mockery/v2/pkg/fixtures/http"
my_http "github.com/vektra/mockery/v3/pkg/fixtures/http"
)

// Example is an example
Expand Down
4 changes: 2 additions & 2 deletions pkg/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"unicode/utf8"

"github.com/rs/zerolog"
"github.com/vektra/mockery/v2/pkg/config"
"github.com/vektra/mockery/v2/pkg/logging"
"github.com/vektra/mockery/v3/pkg/config"
"github.com/vektra/mockery/v3/pkg/logging"
"golang.org/x/tools/imports"

Check failure on line 22 in pkg/generator.go

View workflow job for this annotation

GitHub Actions / build (macos-latest, 1.19)

missing go.sum entry for module providing package golang.org/x/tools/imports (imported by github.com/vektra/mockery/v3/pkg); to add:

Check failure on line 22 in pkg/generator.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 1.19)

missing go.sum entry for module providing package golang.org/x/tools/imports (imported by github.com/vektra/mockery/v3/pkg); to add:
)

const mockConstructorParamTypeNamePrefix = "mockConstructorTestingT"
Expand Down
Loading
Loading