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
315 B
Go

4 years ago
package main
import (
"time"
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/core/logx"
4 years ago
)
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)
}