Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreben committed Jan 24, 2018
1 parent 1425114 commit c85b5c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ RUN echo Done being slow

```bash
docker build . |
ts -start "^Step " |
ts -start ^Step |
jq -s 'max_by(.deltaNanos) | {step:.start, duration:.delta}'
```

Expand Down
9 changes: 5 additions & 4 deletions cmd/ts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ func timeFormatsHelp() string {
return buf.String()
}

var start *regexp.Regexp

func init() {
flag.StringVar(&config.template, "template", "", "go template (https://golang.org/pkg/text/template)")
flag.StringVar(&config.timeFormat, "timeformat", "RFC3339", timeFormatsHelp())
Expand All @@ -107,6 +109,9 @@ func init() {
} else {
printer = jsonPrinter()
}
if config.start != "" {
start = regexp.MustCompile(config.start)
}
}

func main() {
Expand All @@ -117,10 +122,6 @@ func main() {
first := now
previous := ""
i := uint64(0)
var start *regexp.Regexp
if config.start != "" {
start = regexp.MustCompile(config.start)
}
for scanner.Scan() {
now = time.Now()
delta := now.Sub(last)
Expand Down

0 comments on commit c85b5c5

Please sign in to comment.