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

Wildcard ignore not working #1264

Closed
mortyccp opened this issue Oct 13, 2017 · 7 comments · Fixed by #1268
Closed

Wildcard ignore not working #1264

mortyccp opened this issue Oct 13, 2017 · 7 comments · Fixed by #1268

Comments

@mortyccp
Copy link

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

v0.3.1-122-g98f625e

What dep command did you run?

dep hash-inputs

-CONSTRAINTS-
-IMPORTS/REQS-
github.com/jinzhu/gorm
github.com/jinzhu/gorm/dialects/mysql
-IGNORES-
github.com/jinzhu/gorm*
-OVERRIDES-
-ANALYZER-
dep
1

dep ensure -v

Root project is "navicat.com/navicat/playground/depbug"
 1 transitively valid internal packages
 2 external packages imported from 1 projects
(0)   ✓ select (root)
(1)	? attempt github.com/jinzhu/gorm with 2 pkgs; 7 versions to try
(1)	    try github.com/jinzhu/gorm@v1.0
(1)	✓ select github.com/jinzhu/gorm@v1.0 w/2 pkgs
  ✓ found solution with 2 packages from 1 projects

Solver wall times by segment:
     b-source-exists: 2.644095774s
              b-gmal: 150.504996ms
         b-list-pkgs: 142.178567ms
         select-root:      88.11µs
            new-atom:     81.607µs
             satisfy:     37.979µs
         select-atom:     35.615µs
               other:     33.034µs
     b-list-versions:     28.357µs
  b-deduce-proj-root:        733ns

  TOTAL: 2.937084772s

(1/1) Wrote github.com/jinzhu/gorm@v1.0

What did you expect to see?

dep status

PROJECT                 CONSTRAINT  VERSION  REVISION  LATEST   PKGS USED

What did you see instead?

dep status

PROJECT                 CONSTRAINT  VERSION  REVISION  LATEST   PKGS USED
github.com/jinzhu/gorm  *           v1.0     5174cc5   5174cc5  2
@darkowlzz
Copy link
Collaborator

darkowlzz commented Oct 13, 2017

This looks correct behavior to me. Ignoring github.com/jinzhu/gorm* means ignore source code static analysis of that package and subpackages. So, all the imports of gorm, like github.com/go-sql-driver/mysql, github.com/lib/pq, etc would be ignored. But gorm package itself would still be vendored.

@sdboyer correct me?

@sdboyer
Copy link
Member

sdboyer commented Oct 13, 2017

I've been wrestling with that question recently - I'm not sure what my original intent was. I need to revisit the docs/spec I originally wrote and check over the existing system for sanity in this regard.

@e-nikolov
Copy link

e-nikolov commented Oct 18, 2017

Somewhat related to this, is it possible to instruct dep to ignore all dependencies that come from a local package?

In my specific case inside my repo, I have a directory called plugins/, which contains the source codes for several go plugins, each of which has its own vendor/ directory that contains all of its dependencies. The plugin dependencies are therefore not needed inside the main vendor/ directory, but they still appear there. I tried adding several variations of the ignored parameter inside the Gopkg.toml with no success. I tried:

ignored = ["./plugins/*", "./plugins*", "bitbucket.org/<user>/<repo>/plugins*"]

@sdboyer
Copy link
Member

sdboyer commented Oct 18, 2017

we definitely need clearer docs on the syntax here.

the expectation, as with real import paths in a project that point to other packages within that project, is that you provide the full import path - not a relative one. that should have the desired effect.

@e-nikolov
Copy link

I tried that as well, but didn't work. Is it possible that dep can't ignore local packages?

I have the repo https://github.com/e-nikolov/my-real-repo/ that demonstrates what I do.

It has this in ignored:

ignored = ["github.com/e-nikolov/my-real-repo/plugins*", "github.com/e-nikolov/my-fake-repo/plugins*"]

Where my-real-repo is the repo itself and my-fake-repo is a non-existent repo.

When I run dep hash-inputs, it only shows my-fake-repo under -IGNORES-, and all dependencies are still placed inside the main vendor/. This suggests to me that the "ignored" clause is ignored for local packages.

@darkowlzz
Copy link
Collaborator

darkowlzz commented Oct 19, 2017

@e-nikolov yes, ignores from current project aren't added to hash-inputs' ignore list. They are implicitly included. But it seems to work fine in your repo.

I cloned your repo and ran dep ensure, it cleared github.com/go-chi/chi from /vendor/ which exists in master. And that's because the ignore is working. If I remove "github.com/e-nikolov/my-real-repo/plugins*" from ignored list, and run ensure, github.com/go-chi/chi is added back. Since go-chi/chi is imported by plugins package only, not by the root package, it seems to work correctly.

NOTE that ignore is just ignoring static code analysis of the specified packages, not ignoring to vendor them.

Hope this helps :)

@e-nikolov
Copy link

e-nikolov commented Oct 19, 2017

Which revision of dep do you use? When I run dep ensure here, it doesn't remove chi from the main vendor.

Edit: It works with v0.3.2. I hadn't realized that wildcard ignore is a new feature.

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

Successfully merging a pull request may close this issue.

4 participants