How to measure execution time in Go

While developing Giraffe, I want to measure the execution time of the static files building process.

Here is the example code using time package:

start := time.Now()

// build process...

duration := time.Since(start)
fmt.Println("Duration:", duration)

or

start := time.Now()

// build process...

end := time.Now()
fmt.Println("Duration:", end.Sub(start))

Demo