gvt icon indicating copy to clipboard operation
gvt copied to clipboard

Create an "imports" command

Open landaire opened this issue 8 years ago • 11 comments

Per our discussion on twitter, I proposed creating a new command which would allow the user to vendor third-party dependencies in an existing project without needing to run "gvt fetch" for each.

Command Details

Name: imports Flags:

  • no-recurse - don't recursively fetch dependencies
  • precaire - allow insecure protocols

Usage: imports [-precaire] [-no-recurse] Description: Scan the project's source files for third-party imports and fetch/add them to the manifest file if they do not already exist.

Notes

Both flags have the same usage as in the existing fetchcommand. The current problem that exists is this tool only reads strictly from the manifest file (as does gb-vendor). I think that the go/ast package an be utilized on *.go files in the project directory (recursively) to get all imports. Logic for determining imports that need to be fetch'd can be referenced from the go get command here (see the download func).

That same logic could also be used for extending the normal fetch command to support repositories which do not have a manifest file.

landaire avatar Oct 14 '15 22:10 landaire