Compare Two Dates in Golang

package main

import (
	"fmt"
	"time"
)

func main() {

	date1 := time.Date(2021, 12, 15, 0, 0, 0, 0, time.UTC)
	date2 := time.Date(2021, 12, 19, 0, 0, 0, 0, time.UTC)

	if date1.Before(date2) {
		fmt.Println("date 1 < date 2")
	} else if date1.Equal(date2) {
		fmt.Println("date 1 = date 2")
	} else {
		fmt.Println("date 1 > date 2")
	}

}
date 1 < date 2