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

Running -format with GOFLAGS="-mod=vendor" fails if project has indirect dependencies #15

Closed
nezorflame opened this issue Sep 30, 2019 · 1 comment

Comments

@nezorflame
Copy link
Contributor

nezorflame commented Sep 30, 2019

From what I can see, this happens:

  1. gopkgs runs go list -mod=vendor -m -f={{.Path}}\;{{.Dir}} (notice that -mod=vendor is not in the code, but since we have GOFLAGS="-mod=vendor" it'll be acting if it was): https://github.com/uudashr/gopkgs/blob/master/gopkgs.go#L366
  2. The output shows ALL of the packages, including the indirect ones
  3. While walking through the list of packages in the loop https://github.com/uudashr/gopkgs/blob/master/gopkgs.go#L94 we eventually stumble upon an indirect dependency which wasn't pulled by go mod vendor, which in turn results in a folder which doesn't exist, hence causing the stat error.

I guess, there're two possible solutions:

  1. Exclude indirect dependencies by using the {{if not .Indirect}}{{.Path}};{{.Dir}}{{end}} flag value for go list -f
  2. Somehow make go mod vendor download the indirect dependencies as well (doubt that).

See details in microsoft/vscode-go#2800

@uudashr
Copy link
Owner

uudashr commented Oct 14, 2019

Should be fixed on #16

@uudashr uudashr closed this as completed Oct 14, 2019
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

2 participants