You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/example/config/loadfromyaml/main.go

22 lines
269 B
Go

package main
import (
"time"
"zero/core/conf"
"zero/core/logx"
)
type TimeHolder struct {
Date time.Time `json:"date"`
}
func main() {
th := &TimeHolder{}
err := conf.LoadConfig("./date.yml", th)
if err != nil {
logx.Error(err)
}
logx.Infof("%+v", th)
}