Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

Commit

Permalink
Adds option to get subcommand to download test package dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbokorney authored and usgbakerb committed Nov 25, 2015
1 parent 5e3d21a commit 0959752
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v30 2015/11/25

* Add `-t` flag to the `godep get` command.

# v29 2015/11/17

* Temp work around to fix issue with LICENSE files.
Expand Down
11 changes: 10 additions & 1 deletion get.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

var cmdGet = &Command{
Usage: "get [-v] [packages]",
Usage: "get [-v] [-t] [packages]",
Short: "download and install packages with specified dependencies",
Long: `
Get downloads to GOPATH the packages named by the import paths, and installs
Expand All @@ -18,13 +18,18 @@ as if by go get.
If -verbose is given, verbose output is enabled.
If -t is given, dependencies of test files are also downloaded and installed.
For more about specifying packages, see 'go help packages'.
`,
Run: runGet,
}

var getT bool

func init() {
cmdGet.Flag.BoolVar(&verbose, "v", false, "enable verbose output")
cmdGet.Flag.BoolVar(&getT, "t", false, "get test dependencies")
}

func runGet(cmd *Command, args []string) {
Expand All @@ -37,6 +42,10 @@ func runGet(cmd *Command, args []string) {
cmdArgs = append(cmdArgs, "-v")
}

if getT {
cmdArgs = append(cmdArgs, "-t")
}

err := command("go", append(cmdArgs, args)...).Run()
if err != nil {
log.Fatalln(err)
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
)

const version = 29
const version = 30

var cmdVersion = &Command{
Usage: "version",
Expand Down

0 comments on commit 0959752

Please sign in to comment.