main.go 315 B

123456789101112131415161718192021
  1. package main
  2. import (
  3. "time"
  4. "github.com/tal-tech/go-zero/core/conf"
  5. "github.com/tal-tech/go-zero/core/logx"
  6. )
  7. type TimeHolder struct {
  8. Date time.Time `json:"date"`
  9. }
  10. func main() {
  11. th := &TimeHolder{}
  12. err := conf.LoadConfig("./date.yml", th)
  13. if err != nil {
  14. logx.Error(err)
  15. }
  16. logx.Infof("%+v", th)
  17. }