var previousDate time.Time
...
date, err := time.Parse(dateLayout, dateStr)
...
if previousDate == nil { // ошибка здесь
previousDate = date
} else {
...
}
cannot convert nil to type time.Time
package main
import (
"time"
"fmt"
)
func main() {
var previousDate time.Time
var zeroTime time.Time
if previousDate == zeroTime {
fmt.Println("Is Zero")
}
fmt.Println(previousDate)
}