Skip to content

Commit

Permalink
cob: Add -tags support for ad-hoc build tags. (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: Simarpreet Singh <[email protected]>
  • Loading branch information
simar7 authored and knqyf263 committed Jan 15, 2020
1 parent 8e3da16 commit 9e76d1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type config struct {
bench string
benchmem bool
benchtime string
tags string
}

func newConfig(c *cli.Context) config {
Expand All @@ -19,5 +20,6 @@ func newConfig(c *cli.Context) config {
bench: c.String("bench"),
benchmem: c.Bool("benchmem"),
benchtime: c.String("benchtime"),
tags: c.String("tags"),
}
}
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func main() {
Usage: "Run enough iterations of each benchmark to take t, specified as a time.Duration (for example, -benchtime 1h30s).",
Value: "1s",
},
&cli.StringFlag{
Name: "tags",
Usage: "Run only those benchmarks with the specified build tags.",
},
},
}

Expand Down Expand Up @@ -167,6 +171,9 @@ func prepareBenchArgs(c config) []string {
if c.benchmem {
args = append(args, "-benchmem")
}
if c.tags != "" {
args = append(args, "-tags", c.tags)
}
args = append(args, c.args...)
return args
}
Expand Down

0 comments on commit 9e76d1f

Please sign in to comment.