A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 柠檬leung不酸 黑马粉丝团   /  2019-1-9 09:24  /  4551 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文


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

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马