Skip to content

Commit

Permalink
revert: Remove timing calls [DT-7499]
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolegros committed Nov 26, 2024
1 parent 2e83cc7 commit e340be6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
17 changes: 6 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ package main
import (
"bytes"
"fmt"
"os"
"path"
"path/filepath"
"regexp"
"runtime/debug"
"strings"
"time"

"github.com/coveooss/gotemplate/v3/collections"
"github.com/coveooss/gotemplate/v3/hcl"
"github.com/coveooss/gotemplate/v3/json"
Expand All @@ -23,6 +15,12 @@ import (
"github.com/coveooss/multilogger/errors"
"github.com/fatih/color"
"github.com/sirupsen/logrus"
"os"
"path"
"path/filepath"
"regexp"
"runtime/debug"
"strings"
)

var version = "major.minor.patch # locally built, should be replaced by the build process with -ldflags \"-X main.version=<version number>\""
Expand All @@ -38,7 +36,6 @@ See: https://coveooss.github.io/gotemplate for complete documentation.
`

func runGotemplate() (exitCode int) {
start := time.Now()
defer func() {
if rec := recover(); rec != nil {
errPrintf(color.RedString("Recovered %v\n"), rec)
Expand Down Expand Up @@ -312,8 +309,6 @@ func runGotemplate() (exitCode int) {
if !*printOutput {
utils.TerraformFormat(resultFiles...)
}
duration := time.Since(start)
fmt.Println(fmt.Sprintf("Took %dms", duration.Milliseconds()))
return
}

Expand Down
14 changes: 4 additions & 10 deletions template/extra_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import (
"bytes"
"errors"
"fmt"
"github.com/coveooss/gotemplate/v3/collections"
"github.com/coveooss/gotemplate/v3/utils"
multicolor "github.com/coveooss/multilogger/color"
"github.com/fatih/color"
"os"
"os/exec"
"path"
"reflect"
"strings"
"time"

"github.com/coveooss/gotemplate/v3/collections"
"github.com/coveooss/gotemplate/v3/utils"
multicolor "github.com/coveooss/multilogger/color"
"github.com/fatih/color"
)

const (
Expand Down Expand Up @@ -435,8 +433,6 @@ func (t *Template) runTemplate(source string, args ...interface{}) (result, file
}

func optimizedRunTemplate(t *Template, withClone bool, source string, args ...interface{}) (result, filename string, err error) {
start := time.Now()

if source == "" {
return
}
Expand Down Expand Up @@ -533,8 +529,6 @@ func optimizedRunTemplate(t *Template, withClone bool, source string, args ...in
if withClone {
t.context = parentContext
}
duration := time.Since(start)
fmt.Println(fmt.Sprintf("Took 'runTemplate()' %dms", duration.Milliseconds()))
return

}
Expand Down

0 comments on commit e340be6

Please sign in to comment.