From d8db3207228970be43b3e59496f4b2158bc59566 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Tue, 2 Jan 2024 13:26:51 -0500 Subject: [PATCH] lang: gapi: Prettier printing of type unification timing This makes things a little nicer to visualize. --- lang/gapi/gapi.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lang/gapi/gapi.go b/lang/gapi/gapi.go index ea837b48..6f08c8fd 100644 --- a/lang/gapi/gapi.go +++ b/lang/gapi/gapi.go @@ -332,15 +332,19 @@ func (obj *GAPI) Cli(cliInfo *gapi.CliInfo) (*gapi.Deploy, error) { } unifyErr := unifier.Unify() delta := time.Since(startTime) + formatted := delta.String() + if delta.Milliseconds() > 1000 { // 1 second + formatted = delta.Truncate(time.Millisecond).String() + } if unifyErr != nil { if c.Bool("only-unify") { - logf("type unification failed after %s", delta) + logf("type unification failed after %s", formatted) } return nil, errwrap.Wrapf(unifyErr, "could not unify types") } if c.Bool("only-unify") { - logf("type unification succeeded in %s", delta) + logf("type unification succeeded in %s", formatted) return nil, nil // we end early }