go湖南老乡 2018/2/5 17:55:54
package main
import (
"github.com/kylelemons/go-gypsy/yaml
"
"fmt"
)
type (
// reply to findnode
neighbors struct {
Expiration uint64
confbh int
// Ignore additional fields (for forward compatibility).
}
)
func main(){
config,err:=yaml.ReadFile("./conf.yaml")
fmt.Println(config)
if err!=nil{
fmt.Println(err)
}
str:=neighbors{}
str64,err:=config.GetInt("path")
if err!=nil {
fmt.Println(err)
}
str.confbh=int(str64)
fmt.Println(str.confbh)
}
本地文件格式为 path: 1000
---------------------
作者:不折腾就闹心
来源:CSDN
原文:https://blog.csdn.net/DDFFR/article/details/79263376
|
|