如何在go中声明一个自定义类型的变量(比如time.Date)?

How to declare a variable of a custom type (like time.Date) in go?

我正在尝试创建这段代码:

var nextWorkday time.Date
// var nextWorkday *time.Date // neither works
yyyy, mm, dd := now.Date()
goalTime, _ := time.ParseDuration(fmt.Sprintf("%fh", *goal))
goalSeconds := int(goalTime.Seconds())
if date.Weekday() != time.Friday { // wait till the next workday (7am + difference)
    nextWorkday = time.Date(yyyy, mm, dd+1, 7, 0, 0+goalSeconds, 0, now.Location())
} else {
    nextWorkday = time.Date(yyyy, mm, dd+3, 7, 0, 0+goalSeconds, 0, now.Location())
}
time.Sleep(nextWorkday)

重要的断点已经是第一行了。我不知道如何声明自定义类型的新变量。现在我收到错误: time.Date is not a type

我做错了什么?感谢任何帮助!

标准 time package. There is however a time.Time 类型中没有 time.Date 类型表示时间瞬间,"including" 日期。

time.Date() 是一个根据提供的日期和时间字段构造 time.Time 值的函数。