Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Per-project prune options are ignored #1561

Closed
speijnik opened this issue Jan 24, 2018 · 6 comments · Fixed by #1562 or #1570
Closed

Per-project prune options are ignored #1561

speijnik opened this issue Jan 24, 2018 · 6 comments · Fixed by #1562 or #1570

Comments

@speijnik
Copy link
Contributor

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
* 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
* Use prune options defined per-project when generating gps.RootPruneOptions
* Add test cases checking if this behavior is correct
@sdboyer
Copy link
Member

sdboyer commented Jan 24, 2018

🤦‍♂️

thank you.

sdboyer added a commit that referenced this issue Jan 24, 2018
Fix ignored per-project prune options (#1561)
@pierrre
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
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
Copy link
Member

sdboyer commented Jan 24, 2018

cc @ibrasho

@pierrre
Copy link

pierrre commented Jan 24, 2018

Should I open a new issue?

@sdboyer sdboyer reopened this Jan 24, 2018
@sdboyer sdboyer closed this as completed Jan 24, 2018
@sdboyer sdboyer reopened this Jan 24, 2018
@sdboyer
Copy link
Member

sdboyer commented Jan 24, 2018

yeah, this isn't actually fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants