Skip to content

Instantly share code, notes, and snippets.

@Niraj-Fonseka
Last active December 3, 2018 01:31
Show Gist options
  • Save Niraj-Fonseka/6a257869ae010170950d98e93447bfba to your computer and use it in GitHub Desktop.
Save Niraj-Fonseka/6a257869ae010170950d98e93447bfba to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
)
func main() {
start := time.Now()
FirstFunc()
SecondFunc()
ThirdFunc()
FourthFunc()
fmt.Printf("Total time to finish : %s \n", time.Since(start).String())
}
func FirstFunc() {
fmt.Println("-- Executing first function --")
time.Sleep(7 * time.Second)
fmt.Println("-- First Function finished --")
}
func SecondFunc() {
fmt.Println("-- Executing second function --")
time.Sleep(5 * time.Second)
fmt.Println("-- Second Function finished --")
}
func ThirdFunc() {
fmt.Println("-- Executing third function --")
time.Sleep(2 * time.Second)
fmt.Println("-- Third Function finished --")
}
func FourthFunc() {
fmt.Println("-- Executing fourth function --")
time.Sleep(10 * time.Second)
fmt.Println("-- Fourth Function finished --")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment