mockery icon indicating copy to clipboard operation
mockery copied to clipboard

Generate private interface doesn't work

Open ijalalfrz opened this issue 3 years ago • 3 comments

i'm using mockery version 2.7.4, and i have a private interface:

type elasticsearchRequest interface {
	Do(ctx context.Context, transport esapi.Transport) (resp *esapi.Response, err error)
}

what i did : mockery --exported --name=elasticsearchRequest generated file still use private interface

// Code generated by mockery v2.7.4. DO NOT EDIT.

package mocks

import (
	context "context"

	esapi "github.com/elastic/go-elasticsearch/v7/esapi"
	mock "github.com/stretchr/testify/mock"
)

// elasticsearchRequest is an autogenerated mock type for the elasticsearchRequest type
type elasticsearchRequest struct {
	mock.Mock
}
...

ijalalfrz avatar Mar 23 '21 05:03 ijalalfrz

I am experiencing this as well

Edit: found the root cause, it's because of this: https://github.com/vektra/mockery/blob/9ee1699711f8856a7c20bd9872cd39b3750ffa74/pkg/generator.go#L200 Using the --in-package flag with --exported works. Seems like a bug

built-by-as avatar Mar 23 '21 19:03 built-by-as

Bump

guzmonne avatar May 07 '21 15:05 guzmonne

I hope that this issue will be resolved by the granular level of control the packages configuration feature gives you. Please give that a shot and let me know if it doesn't work.

LandonTClipp avatar Apr 06 '23 21:04 LandonTClipp