2023-01-15 00:21:08 +08:00
|
|
|
package myconf
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConf(t *testing.T) {
|
|
|
|
type Config struct {
|
|
|
|
App struct {
|
|
|
|
Name string
|
|
|
|
Addr string
|
|
|
|
Port int
|
|
|
|
}
|
|
|
|
|
|
|
|
Redis struct {
|
|
|
|
Addr string
|
|
|
|
Db int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var config = &Config{}
|
2024-06-23 11:32:45 +08:00
|
|
|
LoadFile("test.yaml", config)
|
2023-01-15 00:21:08 +08:00
|
|
|
fmt.Printf("%+v\n", config)
|
|
|
|
}
|