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

Per-project prune options are ignored #1561

Closed
speijnik opened this Issue Jan 24, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@speijnik
Copy link
Contributor

speijnik commented Jan 24, 2018

What version of dep are you using (dep version)?

v0.4.0

What dep command did you run?

dep ensure

Gopkg.toml contains per-project prune options which are silently ignored.
Global options have non-go pruning enabled, per-project options has non-go pruning disabled.

What did you expect to see?

Per-project prune options applied, non-go files not pruned for specific project.

What did you see instead?

Global prune options are applied to every project.

Analysis

A quick analysis of this issue shows that fromRawPruneOptions incorrectly applies the global options (from raw, instead of from p) when converting the raw prune options to gps.RootPruneOptions.

I am in the process of preparing a PR with a fix for this problem right now.

speijnik added a commit to speijnik/dep that referenced this issue Jan 24, 2018

Fix ignored per-project prune options (golang#1561)
* Use prune options defined per-project when generating gps.RootPruneOptions
* Add test cases checking if this behavior is correct

speijnik added a commit to speijnik/dep that referenced this issue Jan 24, 2018

Fix ignored per-project prune options (golang#1561)
* Use prune options defined per-project when generating gps.RootPruneOptions
* Add test cases checking if this behavior is correct
@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented Jan 24, 2018

🤦‍♂️

thank you.

sdboyer added a commit that referenced this issue Jan 24, 2018

Merge pull request #1562 from speijnik/per-project-prune-fixes
Fix ignored per-project prune options (#1561)
@pierrre

This comment has been minimized.

Copy link

pierrre commented Jan 24, 2018

I noticed a very strange behavior after this change.

Are per-project options inherited from the top [prune].
I assume so.

However it's not the case.

My config is like this:

[prune]
   unused-packages = true
   go-tests = true
   non-go = true

  [[prune.project]]
    name = "github.com/aaa/bbb"
    non-go = false

With this, the global config

   unused-packages = true
   go-tests = true

is not inherited for the dependency github.com/aaa/bbb

I must write

[prune]
   unused-packages = true
   go-tests = true
   non-go = true

  [[prune.project]]
    name = "github.com/DTSL/aaa/bbb"
    nused-packages = true
    go-tests = true
    non-go = false

Then it works properly, but the command line displays a warning:

dep: WARNING: redundant prune option "go-tests" set for "github.com/aaa/bbb"
dep: WARNING: redundant prune option "unused-packages" set for "github.com/aaa/bbb"
@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented Jan 24, 2018

ugh.

that PR is correct in the small - it processes the data correctly out of Gopkg.toml. but the interleaving of global with per-project options happens elsewhere. perhaps we need to review that, too.

@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented Jan 24, 2018

@pierrre

This comment has been minimized.

Copy link

pierrre commented Jan 24, 2018

Should I open a new issue?

@sdboyer sdboyer reopened this Jan 24, 2018

@sdboyer sdboyer closed this Jan 24, 2018

@sdboyer sdboyer reopened this Jan 24, 2018

@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented Jan 24, 2018

yeah, this isn't actually fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment