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

glide ignore packages in test files #103

Closed
hvnsweeting opened this issue Oct 12, 2015 · 7 comments
Closed

glide ignore packages in test files #103

hvnsweeting opened this issue Oct 12, 2015 · 7 comments

Comments

@hvnsweeting
Copy link

when I run glide guess/glide pin, they showed list of packages but missing those that I use for *_test.go.
Is that a feature or should it be fixed?

Thanks

@mattfarina
Copy link
Member

I had not thought about this before. What's happening here is the go/build package has two separate things for imports. Imports is for your code and TestImports is for any imports in test code. We are just using the former and end up missing test imports.

Should test imports be on the Imports list in the yaml file or should they be on devImports?

@technosophos any thoughts on this?

@technosophos
Copy link
Member

My initial intent when I added devImports was for test and build dependencies.

@davecgh
Copy link

davecgh commented Dec 29, 2015

I see the opposite with https://github.com/syndtr/goleveldb. There are several dependencies that are only needed to run the tests which are included in the imports section of the lock file.

Glide should gain a -t flag (or an aptly named option in the yaml) just like go get has in my opinion. Specifically:

The -t flag instructs get to also download the packages required to build
the tests for the specified packages.

One of the primary purposes of glide is, of course, to provide reproducible builds and installs to end user and developers alike. To that end, testing of dependencies is squarely aimed more at developers than end users and thus should really be opt-in with a flag/optional keyword, just like go get does it. A normal end user will typically want to the produce the final stable binary without needing or wanting to download the additional packages only needed for testing, particularly of dependencies.

It is slightly debatable whether the test-only dependencies of the project itself are included by default, but packages only required by the tests in dependencies should most definitely not be included given the version was specifically pinned because it is already known good and tested.

@krancour
Copy link
Contributor

krancour commented Mar 5, 2016

I am running into this as well. I have a project of just integration tests written in go.

My workaround has been to include a dummy non-test file that looks like this:

package tests

import (
    // This is a workaround for the fact that glide seems not to recursively resolve packages needed
    // only for testing.
    _ "k8s.io/kubernetes/pkg/client/unversioned"
)

But I'd rather not have to do that, obviously.

@mattfarina
Copy link
Member

I've added #320 to track resolving test imports.

@ches ches mentioned this issue Apr 4, 2016
@mattfarina
Copy link
Member

Please see #461 which is trying to fix the management of test imports. Reviews appreciated.

@mattfarina
Copy link
Member

Fixed. Tip of master now handles test imports.

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

5 participants