Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
Added the timer to package as well
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterclaerhout committed Oct 18, 2019
1 parent 7fb5bd8 commit b3abd57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Builder struct {
func (builder Builder) Execute(project common.Project, cfg config.Config) error {

builder.StartTimer()
defer builder.PrintElapsed("\nBuild time:")
defer builder.PrintElapsed("Build time:")

if builder.GOOS == "" {
builder.GOOS = runtime.GOOS
Expand Down
2 changes: 1 addition & 1 deletion internal/common/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ func (t *Timer) StartTimer() {

// PrintElapsed prints the elapsed time to stdout
func (t *Timer) PrintElapsed(prefix string) {
log.Info(prefix, time.Since(t.start))
log.Info("\n", prefix, time.Since(t.start))
}
4 changes: 4 additions & 0 deletions internal/packager/packager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Packager struct {
common.Compressor
common.FileSystem
common.Logging
common.Timer

Concurrency int
Verbose bool
Expand All @@ -26,6 +27,9 @@ type Packager struct {
// Execute executes the command
func (packager Packager) Execute(project common.Project, cfg config.Config) error {

packager.StartTimer()
defer packager.PrintElapsed("Package time:")

if packager.Concurrency < 1 {
packager.Concurrency = runtime.NumCPU()
}
Expand Down

0 comments on commit b3abd57

Please sign in to comment.