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

Fail to generate when path including 'vendor' #405

Open
pelly-ryu opened this issue Sep 13, 2021 · 0 comments
Open

Fail to generate when path including 'vendor' #405

pelly-ryu opened this issue Sep 13, 2021 · 0 comments

Comments

@pelly-ryu
Copy link

Env

v2.9.0, macos

Problem

Mockery fails to generate mocks and outputs an empty file,
when a path including 'vendor' exists in the target interface's import statements.

Detail

note: the included package is not a 3rd party package vendored. there's db table named 'vendor' and /pkg/models/vendor pkg has ORM for it.

Example source

package hihi

import (
	vendorModel "github.com/<org>/<project>/pkg/models/vendor" // it's NOT 3rd party package
)

type Hihi interface {
	GetVendor() vendorModel.Vendor
}

Output

[10:26:59] → mockery --all
13 Sep 21 12:15 KST INF Starting mockery dry-run=false version=2.9.0
13 Sep 21 12:15 KST INF Walking dry-run=false version=2.9.0
13 Sep 21 12:15 KST INF Generating mock dry-run=false interface=Hihi qualified-name=github.com/<org>/<project>/pkg/services/hihi version=2.9.0
Between the lines is the file (mock.go) mockery generated in-memory but detected as invalid:
--------------------------------------------------------------------------------------------
// Code generated by mockery 2.9.0. DO NOT EDIT.

package mocks

import hihi "github.com/<org>/<project>/pkg/services/hihi"
import mock "github.com/stretchr/testify/mock"
import vendor "" // should be "github.com/<org>/<project>/pkg/models/vendor"

(...)
Error walking Hihi: mock.go:7:15: invalid import path: ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant