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

proposal: Go 2: ignore files with '_mock' suffix when compiling #22702

Closed
eggsbenjamin opened this issue Nov 13, 2017 · 2 comments
Closed

proposal: Go 2: ignore files with '_mock' suffix when compiling #22702

eggsbenjamin opened this issue Nov 13, 2017 · 2 comments

Comments

@eggsbenjamin
Copy link

An example of a common go package directory listing;

mypackage/
    - my_package.go
    - my_package_test.go
    - my_package_mock.go

It would be great if files with the suffix _mock.go were treated like files with the suffix _test.go in that they're only picked up by go test and not compiled when running go run or go build. This would mean that mocks could be stored in the same directory as the definitions that they mimic with meaningful names and not get compiled into production binaries.

@gopherbot gopherbot added this to the Proposal milestone Nov 13, 2017
@dominikh
Copy link
Member

What's wrong with foo_mock_test.go?

@bradfitz
Copy link
Contributor

Yes, please just use _mock_test.go. We don't want to add more special cases here, sorry.

@golang golang locked and limited conversation to collaborators Nov 14, 2018
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

4 participants