Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Use "." to refer to the current path's package in reflect mode #388

Closed
XSAM opened this issue Jan 20, 2020 · 2 comments
Closed

Use "." to refer to the current path's package in reflect mode #388

XSAM opened this issue Jan 20, 2020 · 2 comments
Assignees

Comments

@XSAM
Copy link
Contributor

XSAM commented Jan 20, 2020

Introduction

I use go:generate in my source code to invoke mockgen to generate mocked interfaces.

e.g.

//go:generate mockgen -destination=mocks/foo.pb.go github.com/xxx/xxx/pkg/xxx Foo

But it's too annoying that every time I have to write and check the package name (github.com/xxx/xxx/pkg/xxx).

And add the full package name in a source file is kind of duplicated information since golang could parse the file path and get the package name.

Feature request

So I want to add a feature that can use . to refer to the current path's package.

e.g.

//go:generate mockgen -destination=mocks/foo.pb.go . Foo

Just a single ., no more github.com/xxx/xxx/pkg/xxx.

@cvgw
Copy link
Collaborator

cvgw commented Jan 23, 2020

This seems like a reasonable and useful feature, I'm +1 for adding this.

@nguyenfilip @codyoss WDYT?

@minicuts
Copy link
Contributor

@cvgw Yeah seams reasonable

@cvgw cvgw self-assigned this Jan 31, 2020
@cvgw cvgw closed this as completed Feb 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants